Edit preview for dwg (AutoCAD drawing) files
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).
Expected Behavior
- Rocket.Chat should either:
- Recognize
.dwgfiles as non-previewable, or - Treat them with a generic content type such as
application/octet-stream.
- Recognize
Current Behavior
-
.dwgfiles are treated asimage/vnd.dwg - Preview fails to generate, and users see broken or empty previews
- No option in the admin panel to blacklist
.dwgfrom preview
Suggested Improvement
- Add
.dwgto 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!
Hello, the problem is relevant, we also have it when uploading this type of file.
Have you checked the actual mime type of the file?
Have you tried adding one of the application/dwg mime types as per this?
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.
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.