[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:
parent
7a63467610
commit
1fa248b5a7
1 changed files with 9 additions and 2 deletions
|
|
@ -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) => {
|
||||
|
|
|
|||
Loading…
Reference in a new issue