forked from Ivasoft/mattermost-mobile
[Gekidou] Fix mimeType undefined in isImage utility (#6581)
* Fix mimeType undefined in isImage utility * Apply suggestion Co-authored-by: Jason Frerich <jason.frerich@mattermost.com> * remove unecessary return Co-authored-by: Jason Frerich <jason.frerich@mattermost.com>
This commit is contained in:
@@ -267,9 +267,16 @@ export const isImage = (file?: FileInfo | FileModel) => {
|
||||
return false;
|
||||
}
|
||||
|
||||
const mimeType = 'mime_type' in file ? file.mime_type : file.mimeType;
|
||||
if (isGif(file)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return (isGif(file) || mimeType.startsWith('image/'));
|
||||
let mimeType = 'mime_type' in file ? file.mime_type : file.mimeType;
|
||||
if (!mimeType) {
|
||||
mimeType = lookupMimeType(file.extension) || lookupMimeType(file.name);
|
||||
}
|
||||
|
||||
return Boolean(mimeType?.startsWith('image/'));
|
||||
};
|
||||
|
||||
export const isDocument = (file?: FileInfo | FileModel) => {
|
||||
|
||||
Reference in New Issue
Block a user