diff --git a/core/modules/config/lib/Drupal/config/Controller/ConfigController.php b/core/modules/config/lib/Drupal/config/Controller/ConfigController.php index 13917c0..1eb40f3 100644 --- a/core/modules/config/lib/Drupal/config/Controller/ConfigController.php +++ b/core/modules/config/lib/Drupal/config/Controller/ConfigController.php @@ -10,7 +10,6 @@ use Drupal\Core\Controller\ControllerInterface; use Drupal\Core\Config\StorageInterface; use Drupal\Component\Archiver\ArchiveTar; -use Drupal\Core\Extension\ModuleHandlerInterface; use Drupal\system\FileDownloadController; use Symfony\Component\DependencyInjection\ContainerInterface; use Symfony\Component\HttpFoundation\Request; @@ -37,7 +36,7 @@ class ConfigController implements ControllerInterface { /** * The file download controller. * - * @var \Drupal\Core\Controller\ControllerInterface + * @var \Drupal\system\FileDownloadController */ protected $fileDownloadController; @@ -45,10 +44,12 @@ class ConfigController implements ControllerInterface { * {@inheritdoc} */ public static function create(ContainerInterface $container) { + $file_download = new FileDownloadController(); + $file_download->setContainer($container); return new static( $container->get('config.storage'), $container->get('config.storage.staging'), - FileDownloadController::create($container) + $file_download ); } @@ -59,10 +60,10 @@ public static function create(ContainerInterface $container) { * The target storage. * @param \Drupal\Core\Config\StorageInterface $source_storage * The source storage - * @param \Drupal\Core\Controller\ControllerInterface $file_download_controller + * @param \Drupal\system\FileDownloadController $file_download_controller * The file download controller. */ - public function __construct(StorageInterface $target_storage, StorageInterface $source_storage, ControllerInterface $file_download_controller) { + public function __construct(StorageInterface $target_storage, StorageInterface $source_storage, FileDownloadController $file_download_controller) { $this->targetStorage = $target_storage; $this->sourceStorage = $source_storage; $this->fileDownloadController = $file_download_controller; diff --git a/core/modules/image/lib/Drupal/image/Controller/ImageStyleDownloadController.php b/core/modules/image/lib/Drupal/image/Controller/ImageStyleDownloadController.php index cc0cc3f..6820dc8 100644 --- a/core/modules/image/lib/Drupal/image/Controller/ImageStyleDownloadController.php +++ b/core/modules/image/lib/Drupal/image/Controller/ImageStyleDownloadController.php @@ -8,7 +8,7 @@ namespace Drupal\image\Controller; use Drupal\Component\Utility\Crypt; -use Drupal\Core\Config\ConfigFactory; +use Drupal\Core\Controller\ControllerInterface; use Drupal\Core\Image\ImageFactory; use Drupal\Core\Lock\LockBackendInterface; use Drupal\image\ImageStyleInterface; @@ -23,14 +23,7 @@ /** * Defines a controller to serve image styles. */ -class ImageStyleDownloadController extends FileDownloadController { - - /** - * The config factory. - * - * @var \Drupal\Core\config\ConfigFactory - */ - protected $configFactory; +class ImageStyleDownloadController extends FileDownloadController implements ControllerInterface { /** * The lock backend. @@ -49,15 +42,12 @@ class ImageStyleDownloadController extends FileDownloadController { /** * Constructs a ImageStyleDownloadController object. * - * @param \Drupal\Core\Config\ConfigFactory $config_factory - * The config factory. * @param \Drupal\Core\Lock\LockBackendInterface $lock * The lock backend. * @param \Drupal\Core\Image\ImageFactory $image_factory * The image factory. */ - public function __construct(ConfigFactory $config_factory, LockBackendInterface $lock, ImageFactory $image_factory) { - $this->configFactory = $config_factory; + public function __construct(LockBackendInterface $lock, ImageFactory $image_factory) { $this->lock = $lock; $this->imageFactory = $image_factory; } @@ -67,10 +57,7 @@ public function __construct(ConfigFactory $config_factory, LockBackendInterface */ public static function create(ContainerInterface $container) { return new static( - $container->get('module_handler'), - $container->get('config.factory'), $container->get('lock'), - $container->get('string_translation'), $container->get('image.factory') ); } @@ -89,6 +76,8 @@ public static function create(ContainerInterface $container) { * * @throws \Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException * Thrown when the user does not have access to the file. + * @throws \Symfony\Component\HttpKernel\Exception\ServiceUnavailableHttpException + * Thrown when the file is still being generated. * * @return \Symfony\Component\HttpFoundation\BinaryFileResponse|\Symfony\Component\HttpFoundation\Response * The transferred file as response or some error response. @@ -104,7 +93,7 @@ public function deliver(Request $request, $scheme, ImageStyleInterface $image_st // bypass the latter check, but this will increase the site's vulnerability // to denial-of-service attacks. $valid = !empty($image_style) && file_stream_wrapper_valid_scheme($scheme); - if (!$this->configFactory->get('image.settings')->get('allow_insecure_derivatives')) { + if (!$this->config('image.settings')->get('allow_insecure_derivatives')) { $valid &= $request->query->get(IMAGE_DERIVATIVE_TOKEN) === $image_style->getPathToken($image_uri); } if (!$valid) {