mirror of
https://github.com/discourse/discourse.git
synced 2025-01-23 05:45:14 +08:00
cfac49fb10
Related: https://github.com/discourse/discourse/pull/30535 In the PR above, the [content-disposition header](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Disposition) was removed for all non-svg files due to the "attachment" keyword added to them, causing files to be downloaded instead of opening in a new tab when requested. When removing that, it also removed the filename attribute attached to s3 uploads. After some testing, it turns out that `filename` is also respected when next to `inline`, despite it not being obvious [in docs](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Disposition#syntax). This commit adds inline+filename so that users can still download files and have filenames be respected instead of using the s3 hash. ```http <!-- mdn docs --> Content-Disposition: inline Content-Disposition: attachment Content-Disposition: attachment; filename="file name.jpg" Content-Disposition: attachment; filename*=UTF-8''file%20name.jpg <!-- this actually works too --> Content-Disposition: inline; filename="file name.jpg" ``` |
||
---|---|---|
.. | ||
base_store_spec.rb | ||
local_store_spec.rb | ||
s3_store_spec.rb |