Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How can I upload .msg file in Rocket.Chat #7074

Closed
FTDJerry opened this issue May 24, 2017 · 13 comments · Fixed by #8172
Closed

How can I upload .msg file in Rocket.Chat #7074

FTDJerry opened this issue May 24, 2017 · 13 comments · Fixed by #8172

Comments

@FTDJerry
Copy link

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

@jasonfah
Copy link

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

@jasonfah
Copy link

@nishimaki10 pull request - #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.

@staticjinno
Copy link

any eta on this one? (sorry for asking, just cause i saw this is assigned from may)

@Lawri-van-Buel
Copy link
Contributor

I wonder about if 'application/octet-stream' would work.

If it doesn't it means this is a bug.

@staticjinno
Copy link

@Lawri-van-Buel to you question - it's not working

@jasonfah
Copy link

jasonfah commented Sep 11, 2017

@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.

@TriPhoenix
Copy link
Contributor

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.

@ghost
Copy link

ghost commented Sep 18, 2017

I am not able to send *.patch and *.properties files even when we did not set any black list.

@TriPhoenix
Copy link
Contributor

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.

@jasonfah
Copy link

Thanks for the PR. Hopefully it can be fast tracked. The ability to upload all file types is pretty fundamental.

@Lawri-van-Buel
Copy link
Contributor

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.

@rodrigok rodrigok added this to the 0.59.0-rc.6 milestone Sep 18, 2017
rodrigok added a commit that referenced this issue Sep 18, 2017
[FIX] Allow unknown file types if no allowed whitelist has been set (#7074)
rodrigok added a commit that referenced this issue Sep 18, 2017
[FIX] Allow unknown file types if no allowed whitelist has been set (#7074)
lltcggie added a commit to lltcggie/Rocket.Chat that referenced this issue Oct 9, 2017
- ファイルダウンロード時に余計な拡張子が付くことがあるのを修正
- アップロード時にjpeg以外は画像ファイル変換を行わないようにした
- Travis CIの設定変更
- Dockerfileをこのリポジトリの設定に合わせた
- [FIX] Allow unknown file types if no allowed whitelist has been set (RocketChat#7074)
lltcggie pushed a commit to lltcggie/Rocket.Chat that referenced this issue Oct 9, 2017
- ファイルダウンロード時に余計な拡張子が付くことがあるのを修正
- アップロード時にjpeg以外は画像ファイル変換を行わないようにした
- Travis CIの設定変更
- Dockerfileをこのリポジトリの設定に合わせた
- [FIX] Allow unknown file types if no allowed whitelist has been set (RocketChat#7074)
@amateo
Copy link

amateo commented Dec 18, 2017

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.

@jasonfah
Copy link

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.

lltcggie pushed a commit to lltcggie/Rocket.Chat that referenced this issue Jan 7, 2018
- ファイルダウンロード時に余計な拡張子が付くことがあるのを修正
- アップロード時にjpeg以外は画像ファイル変換を行わないようにした
- Travis CIの設定変更
- Dockerfileをこのリポジトリの設定に合わせた
- [FIX] Allow unknown file types if no allowed whitelist has been set (RocketChat#7074)
lltcggie pushed a commit to lltcggie/Rocket.Chat that referenced this issue Jan 7, 2018
- ファイルダウンロード時に余計な拡張子が付くことがあるのを修正
- アップロード時にjpeg以外は画像ファイル変換を行わないようにした
- Travis CIの設定変更
- Dockerfileをこのリポジトリの設定に合わせた
- [FIX] Allow unknown file types if no allowed whitelist has been set (RocketChat#7074)
lltcggie pushed a commit to lltcggie/Rocket.Chat that referenced this issue Jan 7, 2018
- ファイルダウンロード時に余計な拡張子が付くことがあるのを修正
- アップロード時にjpeg以外は画像ファイル変換を行わないようにした
- Travis CIの設定変更
- Dockerfileをこのリポジトリの設定に合わせた
- [FIX] Allow unknown file types if no allowed whitelist has been set (RocketChat#7074)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants