Icons are not loaded on production site with https and rev

Created on 30 November 2020, almost 4 years ago
Updated 9 April 2024, 8 months ago

Problem/Motivation

Icons are not loaded on production site with https and reverse proxy.

Steps to reproduce

Proposed resolution

Found this issue: https://www.drupal.org/project/svg_sanitizer/issues/2894157 and followed the suggested code change:

--- a/html/modules/contrib/flag_rating/src/Plugin/ActionLink/AJAXactionLinkRating.php
+++ b/html/modules/contrib/flag_rating/src/Plugin/ActionLink/AJAXactionLinkRating.php
@@ -8,6 +8,7 @@
 use Drupal\Core\Entity\EntityInterface;
 use Drupal\flag\ActionLink\ActionLinkTypeBase;
 use Drupal\Core\Cache\CacheableMetadata;
+use Drupal\file\Entity\File;
 
 /**
  * Provides the AJAX Rating link type.
@@ -34,17 +35,17 @@ protected function getIcon(FlagInterface $flag) {
     $icon = [];
 
     if ($fid = $flag->getThirdPartySetting('flag_rating', 'action_icon', NULL)) {
-      if ($file = file_load((int) $fid)) {
+      if ($file = File::Load((int) $fid)) {
         if (
           empty(file_validate_extensions($file, 'svg')) &&
-          $raw = file_get_contents(file_create_url($file->getFileUri()))
+          $raw = file_get_contents($file->getFileUri())
         ) {

and as bonus replaced deprecated file_load by Drupal\file\Entity\File::load()

Remaining tasks

User interface changes

API changes

Data model changes

🐛 Bug report
Status

Closed: outdated

Version

1.0

Component

Code

Created by

🇩🇪Germany slowflyer

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024