Commit 1bae8740 authored by Stephen Mustgrave's avatar Stephen Mustgrave
Browse files

SA Advisory 2026-1

parent a33c5a66
Loading
Loading
Loading
Loading
Loading
+8 −0
Changes for src/Controller/DisplayController.php: 8 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -14,6 +14,7 @@ use Drupal\Core\Entity\RevisionableInterface;
use Drupal\Core\Extension\ModuleHandlerInterface;
use Drupal\Core\Logger\LoggerChannelInterface;
use Drupal\Core\Session\AccountInterface;
use Drupal\Core\Site\Settings;
use Drupal\Core\StreamWrapper\StreamWrapperManagerInterface;
use Drupal\Core\StringTranslation\TranslationInterface;
use Drupal\file\FileInterface;
@@ -187,6 +188,13 @@ class DisplayController extends EntityRevisionViewController {
      return $this->updateRenderCache(parent::__invoke($media, $view_mode), $config);
    }

    $response = new CacheableBinaryFileResponse($uri, Response::HTTP_OK, [], FALSE);
    $additional_public_schemes = array_diff(Settings::get('file_additional_public_schemes', []), [
      'private',
      'temporary',
    ]);
    in_array($scheme, $additional_public_schemes, TRUE) ? $response->setPublic() : $response->setPrivate();

    $response = new CacheableBinaryFileResponse($uri, Response::HTTP_OK, [], $scheme !== 'private');
    $response->addCacheableDependency($media);
    $response->addCacheableDependency($file);