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

feat(gateway): Content-Disposition improvements #7677

Merged
merged 2 commits into from
Oct 2, 2020

Conversation

lidel
Copy link
Member

@lidel lidel commented Sep 16, 2020

This PR improves the way gateway supports Content-Disposition, an HTTP header used by browsers as a name hint when saving a file:

This is a fully backward-compatible change, sharness tests included.

cc (#4177@Voker57 @crackcomm @radfish) ipfs/in-web-browsers#132 @andrew @Gozala @autonome

This implements 'attachment' mode triggered then
?filename parameter is accompanied with &download=true

When Content-Disposition: attachment is detected by a modern browser
it will skip rendering and immediately open the "save as" dialog,
making this useful feature for using IPFS gateway as target of
"Download" links on various websites.

Parameter name was suggested in:
#4177 (comment)
This adds ASCII-only filename for clients that do not implement RFC 5987

Closes #7648
Copy link
Contributor

@aschmahmann aschmahmann left a comment

Choose a reason for hiding this comment

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

Looks good, thanks 🙏

@aschmahmann aschmahmann merged commit 9b1171d into master Oct 2, 2020
@lidel lidel deleted the feat/content-disposition-attachment branch October 15, 2020 12:46
@aschmahmann aschmahmann mentioned this pull request Feb 18, 2021
73 tasks
hacdias pushed a commit to ipfs/boxo that referenced this pull request Jan 27, 2023
…attachment

feat(gateway): Content-Disposition improvements

This commit was moved from ipfs/kubo@9b1171d
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.

Add fallback for old browsers when using ?filename parameter
3 participants