Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[11.x] Fix etag headers for binary file responses #52705

Merged
merged 1 commit into from
Sep 9, 2024

Conversation

wouterrutgers
Copy link
Contributor

@wouterrutgers wouterrutgers commented Sep 9, 2024

The getContent method always returns false for instances of BinaryFileResponse or StreamedResponse. Consequently, for any file served via return response()->download(...), the ETag header wil be set to the MD5 hash of false, which is d41d8cd98f00b204e9800998ecf8427e.

This leads to an identical ETag for all downloads, regardless of the actual file content. I propose that the ETag header be removed in cases where the content cannot be determined, as this would provide a more accurate response.

@wouterrutgers wouterrutgers changed the title Fix etag headers for binary file responses [11.x] Fix etag headers for binary file responses Sep 9, 2024
@taylorotwell taylorotwell merged commit f9696a7 into laravel:11.x Sep 9, 2024
33 checks passed
@wouterrutgers wouterrutgers deleted the fix-etag branch September 10, 2024 08:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants