Problem/Motivation

All the PDF files are now opening as normal text rather then as a PDF. After researching, I believe it's connected with the most recent update to symphony (6.1.5). From this issue they are no longer attaching the mime type based on the file but now based on the request. I am not entirely sure how to change the request but as a simple fix we can attach the correct Content-Type header before sending over.

Proposed resolution

By adding this code at the end of the controller, it will always grab the correct mime type.

if (!$response->headers->has('Content-Type')) {
      $response->headers->set('Content-Type', $file->getMimeType() ?: 'application/octet-stream');
    }
Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

mitchel432 created an issue. See original summary.

smustgrave’s picture

Can you provide exact steps and versions you are on?

smustgrave’s picture

Status: Active » Fixed

Someone at my company also reported this issue using Drupal core 9.4.7 with latest version of this module and this fix resolved the issue.

mitchel432’s picture

I was just building my site without the custom profile to write out the reproduction steps. Glad you were able to find the issue as well.

This would be one of my first bugs to do a merge request on. Did I do everything correctly?

smustgrave’s picture

Yup did it perfectly. Easy to review and no conflicts.

For the ticket though I wouldn't remove any section even if they don't apply. Just from what I've seen on other tickets most want that full template even if the section is 'NA'

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.