Incorrect headers for image derivative if effect "Convert" in use and file stored in private filesystem

Created on 19 August 2016, over 8 years ago
Updated 18 April 2024, 8 months ago

Problem/Motivation

Both Content-length and Content-type are returned for original file, not image derivative. BinaryFileResponse fixes content-length but content type remains incorrect when the "Convert" effect in use.

Proposed resolution

Change Drupal\image\Controller\ImageStyleDownloadController::deliver() from:

      $headers += array(
        'Content-Type' => $image->getMimeType(),
        'Content-Length' => $image->getFileSize(),
      ));

to use array_merge:

      $headers = array_merge($headers, [
        'Content-Type' => $image->getMimeType(),
        'Content-Length' => $image->getFileSize(),
      ]);

Remaining tasks

User interface changes

API changes

Data model changes

πŸ› Bug report
Status

Needs work

Version

11.0 πŸ”₯

Component
Image systemΒ  β†’

Last updated 1 day ago

Created by

πŸ‡³πŸ‡΄Norway zaporylie

Live updates comments and jobs are added and updated live.
  • Needs tests

    The change is currently missing an automated test that fails when run with the original code, and succeeds when the bug has been fixed.

Sign in to follow issues

Merge Requests

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