Skip to content

Error uploading file when mime type is undefined and size < 10mb. #6917

@millerlucas

Description

@millerlucas

Rocket.Chat Version: 0.55.1
Running Instances: 1
DB Replicaset OpLog: Disabled
Node Version: v4.8.1

Upload fail when the file type is not recognized by browser and the size is lower than 10 mb.

Uncaught TypeError: Cannot read property 'indexOf' of undefined
    at r (https://chat.teamto.fr/3ddab15a0c8874398ba3db26458f5d286c68a2ef.js?meteor_js_resource=true:260:14377)
    at i (https://chat.teamto.fr/3ddab15a0c8874398ba3db26458f5d286c68a2ef.js?meteor_js_resource=true:260:15133)
    at fileUpload (https://chat.teamto.fr/3ddab15a0c8874398ba3db26458f5d286c68a2ef.js?meteor_js_resource=true:260:18133)
    at Object.dropped .dropzone-overlay (https://chat.teamto.fr/3ddab15a0c8874398ba3db26458f5d286c68a2ef.js?meteor_js_resource=true:264:1461)
    at Object.o.(anonymous function) (https://chat.teamto.fr/3ddab15a0c8874398ba3db26458f5d286c68a2ef.js?meteor_js_resource=true:258:620)
    at https://chat.teamto.fr/3ddab15a0c8874398ba3db26458f5d286c68a2ef.js?meteor_js_resource=true:130:6128
    at Function.e._withTemplateInstanceFunc (https://chat.teamto.fr/3ddab15a0c8874398ba3db26458f5d286c68a2ef.js?meteor_js_resource=true:130:5707)
    at h.View.<anonymous> (https://chat.teamto.fr/3ddab15a0c8874398ba3db26458f5d286c68a2ef.js?meteor_js_resource=true:130:6080)
    at https://chat.teamto.fr/3ddab15a0c8874398ba3db26458f5d286c68a2ef.js?meteor_js_resource=true:129:27045
    at Object.h._withCurrentView (https://chat.teamto.fr/3ddab15a0c8874398ba3db26458f5d286c68a2ef.js?meteor_js_resource=true:129:23116)

The error come from the file rocketchat-ui/client/lib/fileUpload.coffee line 13, file.file.type is undefined.

I think maybe we should avoid trying to preview the file in this case.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions