Skip to content
Merged
5 changes: 5 additions & 0 deletions .changeset/four-houses-doubt.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@rocket.chat/meteor': patch
---

Fixes an issue where an unexpected error is thrown when webdav node doesn't have the mime parameter
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,17 @@ export const getNodeIconType = (
extension = '';
}

if (!mime) {
throw new Error('mime is required');
}

if (fileType === 'directory') {
icon = 'folder';
type = 'directory';
} else if (mime.match(/application\/pdf/)) {
} else if (mime?.match(/application\/pdf/)) {
icon = 'file-pdf';
type = 'pdf';
} else if (['application/vnd.oasis.opendocument.text', 'application/vnd.oasis.opendocument.presentation'].includes(mime)) {
} else if (mime && ['application/vnd.oasis.opendocument.text', 'application/vnd.oasis.opendocument.presentation'].includes(mime)) {
icon = 'file-document';
type = 'document';
} else if (
mime &&
[
'application/vnd.ms-excel',
'application/vnd.oasis.opendocument.spreadsheet',
Expand All @@ -35,7 +32,7 @@ export const getNodeIconType = (
) {
icon = 'file-sheets';
type = 'sheets';
} else if (['application/vnd.ms-powerpoint', 'application/vnd.oasis.opendocument.presentation'].includes(mime)) {
} else if (mime && ['application/vnd.ms-powerpoint', 'application/vnd.oasis.opendocument.presentation'].includes(mime)) {
icon = 'file-sheets';
type = 'ppt';
}
Expand Down