Can we make it possible to attach more file types in Discourse?

Currently it seems it’s only possible to attach images. However, it’s sometimes useful to attach other files such as scripts, code snippets, patches, etc. This used to be possible on the mailing lists; can it be made possible in Discourse too?

Can you suggest a list of extensions you think we should accept?

.txt
.patch
.c
.h
.cpp
.sh
.bat
.cmake

Would be good from the top of my head.

I’m hesitant about bat/sh as they seem like they could easily be executed upon download (I don’t know if a browser nowadays would ask to open a .bat on download and actually execute it…)

I’ll look into the others!

.zip, .gz, etc. would be useful too probably.

1 Like

I’d add .py and .yaml too. Both are used within the LLVM repo somewhere, so it makes sense to be able to pass these around via attachment, on occasion.

.ll, .bc would be good as well

I would think that it wouldn’t be an issue, as long as they were always presented with a Content-Type of text/plain, at least when downloading them. Operating systems haven’t really used extension to determine file type for decades AFAIK!

I’m not sure: if I download a .bat file and double-click on it, how is the OS deciding how to open it other than the extension?

Updated, the list is now: jpg, jpeg, png, gif, heic, heif, pdf, txt, svg, c, patch, h, cpp, cmake, ll, bc, zip, gz, py, json, yaml, mlir, fir

I see; I guess I imagined using Content-Disposition=inline. It’s quite annoying to require all attachments to be downloaded before viewing them. But you’re right, if the file is downloaded then the user would probably just double-click it.