How can I upload .msg file in Rocket.Chat
Hi,
The content-type of outlook file is "application/vnd.ms-outlook".
But it didn't work after I added this MIME type in the admin/FileUpload.
In the "package.js" of Rocket.Chat-file-upload, I found that Rocket.Chat uses the node module-"mime-types".
Then I had tested it
var mime = require('mime-types');
mime.lookup('.msg');
And it returned "false".
How can I add the "application/vnd.ms-outlook" now in the Rocket.Chat if I don't want to allow to upload all type files? Or add the extension type in the "mime-types".
Thanks.
Rocket.Chat Version: 0.44.0 Running Instances: 6 DB Replicaset OpLog: - Node Version: v4.6.0
Also running into the same issue with .hl7 and .gello files.
Clearing the "Accepted Media Types" input and restarting the server does not fix it.
Running snapd version on ubuntu. v0.58.2
@nishimaki10 pull request - https://github.com/RocketChat/Rocket.Chat/pull/5588
File upload is completely broken if the file extension is not known by the mime-db package. I can't see any way to add custom extensions/mime-types.
@MartinSchoeler I believe this should be changed to a bug.
any eta on this one? (sorry for asking, just cause i saw this is assigned from may)
I wonder about if 'application/octet-stream' would work.
If it doesn't it means this is a bug.
@Lawri-van-Buel to you question - it's not working
@Lawri-van-Buel No combination works because it never actually reaches the section of code to check "Accepted Media Types" setting.
If the file extension is unknown to mime-db it returns undefined or null (can't quite remember) which means the file upload process is aborted. Well before it even gets a chance to check "Accepted Media Types".
This is definitely a bug.
I think this may have been introduced accidentally by #7623 which checks for an existing type recognition before the accepted media types whitelist come into play. We encountered the same issue when uploading "unknown" file types as apple number files. We managed to patch around this by using the attached pull request.
I am not able to send *.patch and *.properties files even when we did not set any black list.
Indeed that's the core issue. Currently the code first checks if there is a valid, recognized file type and bails out, if there is none. Only if there is a proper file type being recognized, it actually checks the whitelist (or if there is even a whitelist set). The patch reverses this logic by first checking if the whitelist is empty (in which case all uploads are allowed even if of unknown type) and only then checks if there is a recognized type.
Thanks for the PR. Hopefully it can be fast tracked. The ability to upload all file types is pretty fundamental.
or at least have white listing work without mime lookup. (as a fall-back). I forgot to post my reply but I also verified this issue after posting the octet suggestion.
So, is this bug really fixed? I have updated my rocket.chat server to 0.59.6 and I'm trying to upload a jmx file (jmeter test file), but I get the Media Types Not Accepted error, although this file is detected as application/xml in my system and I have this type allowed in the Accepted Media Types option.
Yes it has been fixed @amateo. Check the comments earlier in the thread. The mime types are not pulled from your system but from a node package called mime-db. It has it's own database of mime types.
If you want to allow mime types that mime-db does not know about, you have to allow all.