Skip to content

Can't upload ovpn file #31692

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

Closed
emoxam opened this issue Feb 8, 2024 · 17 comments · Fixed by #32478
Closed

Can't upload ovpn file #31692

emoxam opened this issue Feb 8, 2024 · 17 comments · Fixed by #32478

Comments

@emoxam
Copy link

emoxam commented Feb 8, 2024

Can't send ovpn file

Steps to reproduce:

  1. try to send ovpn file
  2. see "media types not accepted"

Expected behavior:

i can send it as it was before.

Actual behavior:

"media types not accepted" error

Server Setup Information:

  • Version of Rocket.Chat Server: installed: 6.6.0 (1602) 361MB -
  • Operating System: ubuntu
  • Deployment Method: snap
  • Number of Running Instances: 1
  • DB Replicaset Oplog:
  • NodeJS Version:
  • MongoDB Version:

Client Setup Information

  • Desktop App or Browser Version: 3.9.12
  • Operating System: Windows
@dolohow
Copy link

dolohow commented Feb 14, 2024

Same problem here with 6.6.0, can't send gpg files and in admin settings I am not blocking any file type. In previous version (6.5.x) it did work.

@IgorOhrimenko
Copy link

IgorOhrimenko commented Feb 16, 2024

Not only ovpn file does not upload. You can try to create the empty file with name 1 and gave the same problem "Media Type Not Accepted:"

@roman-bergman
Copy link

roman-bergman commented Feb 27, 2024

Screenshot from 2024-02-27 11-41-03
I got the following mimetype for *.ovpn: text/plain.
I added this mimetype to "Accepted Media Types" but i get the same error: "media types not accepted".

See my comment #31346 (comment)

@IvanBadikovJoyrun
Copy link

Check mimeTypes.ts in the app/utils/lib.

The extension of your file is not defined in the mime-db repo, so the type of your file should become undefined during lookup in the app/client/views/room/body/hooks/useFileUploadDropTarget.ts file line 57.

I guess you should define your own type in the mimeTypes.ts in app/utils/lib in order to make it work.

@emoxam
Copy link
Author

emoxam commented Feb 29, 2024

ovpn file is text/plain
the same has txt files..

Can we turn off media type checking at all ?

@roman-bergman
Copy link

roman-bergman commented Feb 29, 2024

Check mimeTypes.ts in the app/utils/lib.

The extension of your file is not defined in the mime-db repo, so the type of your file should become undefined during lookup in the app/client/views/room/body/hooks/useFileUploadDropTarget.ts file line 57.

I guess you should define your own type in the mimeTypes.ts in app/utils/lib in order to make it work.

mime type ovpn file is text/plain. Mime-db have next extensions: "txt","text","conf","def","list","log","in","ini"
Screenshot from 2024-02-29 11-05-23
It seems to me that the check goes not only on the mimetype but also on its extension. If i change extension .ovpn to .txt my file is load to rocketchat.
Screenshot from 2024-02-29 11-07-59

@emoxam
Copy link
Author

emoxam commented Feb 29, 2024

Ok, can we make changes at the mime db ?

@emoxam
Copy link
Author

emoxam commented Feb 29, 2024

Not only ovpn file does not upload. You can try to create the empty file with name 1 and gave the same problem "Media Type Not Accepted:"

Can you send ovpn file via web interface ?

@roman-bergman
Copy link

Not only ovpn file does not upload. You can try to create the empty file with name 1 and gave the same problem "Media Type Not Accepted:"

Can you send ovpn file via web interface ?

only if rename file from .ovpn to .txt

@IvanBadikovJoyrun
Copy link

Check mimeTypes.ts in the app/utils/lib.
The extension of your file is not defined in the mime-db repo, so the type of your file should become undefined during lookup in the app/client/views/room/body/hooks/useFileUploadDropTarget.ts file line 57.
I guess you should define your own type in the mimeTypes.ts in app/utils/lib in order to make it work.

mime type ovpn file is text/plain. Mime-db have next extensions: "txt","text","conf","def","list","log","in","ini" Screenshot from 2024-02-29 11-05-23 It seems to me that the check goes not only on the mimetype but also on its extension. If i change extension .ovpn to .txt my file is load to rocketchat. Screenshot from 2024-02-29 11-07-59

I guess, it throws a media type alert due to extension check, as type is left undefined since checking if there's no such extension in the mime-db. So, in order to allow the media type, there are two ways to upload files that don't consume mime-db:

  • Append allowed extension and require the receiver to rename the file
  • Modify mime-db or define it directly in the sources
  • Pack the file into a zip-archive... I prefer this way personally :))

image

@IvanBadikovJoyrun
Copy link

IvanBadikovJoyrun commented Feb 29, 2024

Not only ovpn file does not upload. You can try to create the empty file with name 1 and gave the same problem "Media Type Not Accepted:"

It's because the file does not pass the extension check as the extension is not defined in the mime-db. The error occurs on the Rocket.Chat frontend side. You can check my first answer. But to be honest, I don't think there's a way to define an empty extension in the mime-db but you can try.

@emoxam
Copy link
Author

emoxam commented Mar 1, 2024

Then - I did unsquashfs rocketchat-server_1603.snap
added ovpn to

/home/gsys/222/squashfs-root/programs/server/npm/node_modules/mime-db/db.json
/home/gsys/222/squashfs-root/programs/web.browser/dynamic/node_modules/mime-db/db.json
/home/gsys/222/squashfs-root/programs/web.browser.legacy/dynamic/node_modules/mime-db/db.json

and then
mksquashfs squashfs-root rocketchat-server_1603.snap -noappend -comp lzo -no-fragments
somehow i can send ovpn via the web, but now via the windows desktop app...

You can check it then

cat /snap/rocketchat-server/current/programs/server/npm/node_modules/mime-db/db.json | grep ovpn
cat /snap/rocketchat-server/current/programs//web.browser/dynamic/node_modules/mime-db/db.json | grep ovpn
cat /snap/rocketchat-server/current/programs/web.browser.legacy/dynamic/node_modules/mime-db/db.json | grep ovpn

@Thanush19
Copy link

@emoxam ,if the issue is not resolved yet , i can work on this...

@emoxam
Copy link
Author

emoxam commented Mar 13, 2024

@emoxam ,if the issue is not resolved yet , i can work on this...

I will be very appreciate this!

@Thanush19
Copy link

can u assign it to me.. @emoxam ...

@emoxam
Copy link
Author

emoxam commented Mar 13, 2024

@Thanush19 I am an ordinary user, i don't have such rights. Or i just don't know how ?

@crose-project
Copy link

crose-project commented Apr 22, 2024

We have the same problems with .py, .drawio, .r and .rmd files in RocketChat App and Browser. None of the named have official MIME types assigned (as far as I know). I my experience as a web developer: relying on MIME types creates a lot of headaches. Finally (in our own web applications), we check for MIME types (where possible) and if this fails, we check for filename extensions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants