-
Notifications
You must be signed in to change notification settings - Fork 112
return Content-Disposition header alongside content #527
Comments
I would like to take this ticket. A bit investigated:
Will discover more tomorrow. |
@nizsheanez you can have it :) please join our gitter channel for any questions that might arise. |
Thank you. Here is the reason:
But:
Good news - Do i need change |
@nizsheanez correct; I opened a related issue yesterday (for different reasons) about the topic - that we should switch to magic-number based MIME type detection and dump the extension based detection. it is also not being used properly for when uploading a directory. see #944 both should use magic number detection. I think that for one thing - the uploading code should be fixed to fall back to |
Add Content-Disposition http header
Add Content-Disposition http header
Add Content-Disposition http header
Add Content-Disposition http header
Add Content-Disposition http header
Created PR about Content-Disposition first: Also, looks like need to review all places where expected "Content-Type" of file from client and:
btw, is that ok that i keeping discussion here instead of Gitter? In my head - Gitter for some common questions. |
…sphere#527, ethersphere#944) Changed swarm/api.Upload: - when using WaitGroup no reason to use done counter. - f.Close() must be called in Defer - otherwise panic or future added early return will cause leak of file descriptors - use common DetectContentType method - one error was suppressed
Sure let's keep the conversation here. Adding the validation is a good idea - go for it. Same for fallbacks. You should be able to cover everything from the The rest of the codebase only cares about mime types in the context of manifest traversals - which in this case looks for an |
Done |
…eReview (ethersphere#527, ethersphere#944) Fixes for ethersphere#945 - revert back channel which handle I/O throttling - add tests on real files - add tests when file extension doesn't match content - move code to existing files, no real reason to have dedicated file for such functions - move http headers validation to swarm/api/http package - swarm.Open now checking content of file to detect Content Type
…phere#944) - add hardcoded mime types list - follow stdlib way of ContentType checking
…where possible (ethersphere#527, ethersphere#944) - simplified I/O throttling by semaphore primitive - don't use URL from request, use parsed Swarm uri for file name detection
…on only since go1.11, a bit of copy-paste (ethersphere#527, ethersphere#944)
…on only since go1.11, a bit of copy-paste (ethersphere#527, ethersphere#944) - added text/markdown content type
…on only since go1.11, a bit of copy-paste (ethersphere#527, ethersphere#944) - added text/markdown content type
…ion from attachment to inline (ethersphere#527, ethersphere#944) - If I go to bzz://mysite.eth/index.html in my browser, I expect to see the HTML in the browser, not download it to a local file.
…ion from attachment to inline (ethersphere#527, ethersphere#944) - If I go to bzz://mysite.eth/index.html in my browser, I expect to see the HTML in the browser, not download it to a local file.
…ator added, based on mailcap mime.types file (ethersphere#527, ethersphere#944)
…ator added, based on mailcap mime.types file (ethersphere#527, ethersphere#944)
…http: cross-platform Content-Type detection, add Content-Disposition http header (ethersphere#527, ethersphere#944) - Mime types generator (Standard "mime" package rely on system-settings, see mime.osInitMime) - Changed swarm/api.Upload: - simplify I/O throttling by semaphore primitive and use file name where possible - f.Close() must be called in Defer - otherwise panic or future added early return will cause leak of file descriptors - one error was suppressed
…http: cross-platform Content-Type detection, add Content-Disposition http header (ethersphere#527, ethersphere#944) - Mime types generator (Standard "mime" package rely on system-settings, see mime.osInitMime) - Changed swarm/api.Upload: - simplify I/O throttling by semaphore primitive and use file name where possible - f.Close() must be called in Defer - otherwise panic or future added early return will cause leak of file descriptors - one error was suppressed
The HTTP server should return a
Content-Disposition
Header alongside with content so that browsers/http clients could know how to save a file.The server should determine the filename according to what's in the path section of the URI/Manifest path entry, or fall back to the content hash at worst case.
e.g.
Content-Disposition: attachment; filename="filename.jpg"
The text was updated successfully, but these errors were encountered: