diff --git a/src/Controller/S3fsImageStyleDownloadController.php b/src/Controller/S3fsImageStyleDownloadController.php index 21286f6..7d41f9f 100644 --- a/src/Controller/S3fsImageStyleDownloadController.php +++ b/src/Controller/S3fsImageStyleDownloadController.php @@ -60,15 +60,11 @@ class S3fsImageStyleDownloadController extends ImageStyleDownloadController { } $derivative_uri = $image_style->buildUri($image_uri); - $headers = array(); - // If using the private scheme, let other modules provide headers and - // control access to the file. + // private scheme use ImageStyleDownloadController::deliver() instead of + // this. if ($scheme == 'private') { - $headers = $this->moduleHandler()->invokeAll('file_download', array($image_uri)); - if (in_array(-1, $headers) || empty($headers)) { - throw new AccessDeniedHttpException(); - } + throw new AccessDeniedHttpException(); } // Don't try to generate file if source is missing. diff --git a/src/PathProcessor/S3fsPathProcessorImageStyles.php b/src/PathProcessor/S3fsPathProcessorImageStyles.php index 88b8fb5..6f90db2 100644 --- a/src/PathProcessor/S3fsPathProcessorImageStyles.php +++ b/src/PathProcessor/S3fsPathProcessorImageStyles.php @@ -36,19 +36,10 @@ class S3fsPathProcessorImageStyles implements InboundPathProcessorInterface { if (substr_count($rest, '/') >= 2) { list($image_style, $scheme, $file) = explode('/', $rest, 3); - switch ($scheme) { - case 'public': - // Set the file as query parameter. - $request->query->set('file', $file); - $path = static::IMAGE_STYLE_PATH_PREFIX . $image_style . '/' . $scheme; - break; - case 'private': - $path_prefix = '/system/files/styles/'; - break; - } - - if (isset($path_prefix)) { - $path = str_replace(static::IMAGE_STYLE_PATH_PREFIX, $path_prefix, $path); + if ($scheme ==='public') { + // Set the file as query parameter. + $request->query->set('file', $file); + $path = static::IMAGE_STYLE_PATH_PREFIX . $image_style . '/' . $scheme; } } } diff --git a/src/S3fsServiceProvider.php b/src/S3fsServiceProvider.php index ca2e443..2b65ac1 100644 --- a/src/S3fsServiceProvider.php +++ b/src/S3fsServiceProvider.php @@ -37,4 +37,5 @@ class S3fsServiceProvider implements ServiceModifierInterface { ->setClass('Drupal\s3fs\StreamWrapper\PrivateS3fsStream'); } } + }