Rocket.Chat icon indicating copy to clipboard operation
Rocket.Chat copied to clipboard

Edit preview for dwg (AutoCAD drawing) files

Open namph2402 opened this issue 7 months ago • 4 comments

Description

When uploading .dwg (AutoCAD drawing) files to Rocket.Chat, they are automatically assigned the MIME type image/vnd.dwg. Rocket.Chat tries to generate a preview for the file, assuming it is an image, but the preview generation fails (since .dwg is not a viewable image format).

Image

Expected Behavior

  • Rocket.Chat should either:
    • Recognize .dwg files as non-previewable, or
    • Treat them with a generic content type such as application/octet-stream.

Current Behavior

  • .dwg files are treated as image/vnd.dwg
  • Preview fails to generate, and users see broken or empty previews
  • No option in the admin panel to blacklist .dwg from preview

Suggested Improvement

  • Add .dwg to the list of extensions that are excluded from preview generation
  • Or allow admins to define a list of MIME types or extensions that should not generate previews

Environment

  • Rocket.Chat version: 7.7.0
  • Deployment: Docker
  • Browser: Chrome
  • OS: Ubuntu

Thank you!

namph2402 avatar Jun 06 '25 03:06 namph2402

Hello, the problem is relevant, we also have it when uploading this type of file.

MarlynxLinux avatar Jun 07 '25 09:06 MarlynxLinux

Have you checked the actual mime type of the file?

Have you tried adding one of the application/dwg mime types as per this?

Screenshot_20250607_133045_Firefox Beta.jpg

reetp avatar Jun 07 '25 11:06 reetp

Yes, I have checked. When I upload a .dwg file, the browser or system detects the MIME type as image/vnd.dwg, which causes Rocket.Chat to treat it like an image and attempt to generate a preview. However, .dwg files are not viewable images and the preview fails.

Even if I try to override the server to use application/octet-stream, Rocket.Chat still attempts to preview the file — possibly based on the original MIME type or file extension.

namph2402 avatar Jun 10 '25 08:06 namph2402

Please show us the MIME type before you do anything with it.

This should show you.

find . -type f -exec file {} \;

Trying to determine what the ACTUAL type is and whether Rocket has correctly or incorrectly identified it.

reetp avatar Jun 10 '25 11:06 reetp