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

Fix HTTP headers when downloading files #2031

Merged

Conversation

williamjallen
Copy link
Collaborator

#1796 introduced the usage of Laravel's Storage::download() helper, which forced the browser to download all files by default. This change was inconvenient for many users who wanted to view simple text files.

This PR modifies the HTTP headers such that text files will be opened in the browser, and binary files will be downloaded in all major browsers. By setting the content-type to text/plain, the possibility of XSS attacks is mitigated.

Copy link
Contributor

@zackgalbreath zackgalbreath left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this suggested change will fix the failing test in CI

app/Http/Controllers/BuildController.php Outdated Show resolved Hide resolved
Co-authored-by: Zack Galbreath <zack.galbreath@kitware.com>
@williamjallen
Copy link
Collaborator Author

williamjallen commented Feb 14, 2024

Merging manually due to open.cdash.org slowness...

@williamjallen williamjallen merged commit 4361f69 into Kitware:releases/3.2 Feb 14, 2024
1 check passed
@williamjallen williamjallen deleted the headers-for-downloaded-files branch February 14, 2024 18:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants