Download links for .txt (and .yaml) attachments show raw text instead of dowload

on our Discourse instance, if a user uploads a .txt or .yaml file as an attachment, the filename is shown as a download link:

links

but clicking on these does not download the file, it opens a new browser tab with the raw text, loading from an URL like

https://discourse-attachments.s3.dualstack.us-west-2.amazonaws.com/original/2X/4/xxxxxxxx.txt

How to make the download link actually download the file? Enabling “Secure uploads” was suggested as an option but after reading about that I’m a bit hesitant to enable it.

Thanks,

– Charles

yea this is likely a configuration problem with your forum, perhaps to do with CDN or S3.

i could be wrong, but i believe it is how uploads are being served on your forum, whether it’s local storage or S3 /object/ CDN. it could be the HTTP response header?

i think if the content-dispostion: attachment header is present, browsers should usually download the file, but if it is missing, browsers often open .txt / .yml.

test.yml (5 Bytes)

^ that .yml file should download as expected.

edit: i think this topic may be relevant: