Skip to content

Conversation

michalsn
Copy link
Member

Description
This PR fixes a bug in DownloadResponse::inline() method where filename parameters were missing for content disposition. This caused browsers to fall back to using the last URL segment as the filename instead of the intended filename.

The browser will display the filename that was set for image and PDF files.

I added addslashes() because if the filename contains a quote character ("), it would break the header syntax by prematurely terminating the quoted string.

The problem was recognized here: https://forum.codeigniter.com/showthread.php?tid=93147

Checklist:

  • Securely signed commits
  • Component(s) with PHPDoc blocks, only if necessary or adds value
  • Unit testing, with >80% coverage
  • User guide updated
  • Conforms to style guide

@michalsn michalsn added the bug Verified issues on the current code behavior or pull requests that will fix them label Jul 16, 2025
@samsonasik samsonasik merged commit 90edae6 into codeigniter4:develop Jul 18, 2025
50 checks passed
@samsonasik
Copy link
Member

Thank you @michalsn

@michalsn michalsn deleted the fix/content-disposition branch July 30, 2025 06:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Verified issues on the current code behavior or pull requests that will fix them
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants