Fix: type missing of remote file in chat (#9652)

This commit is contained in:
KVOJJJin 2024-10-22 17:54:48 +08:00 committed by GitHub
parent 5267f34e76
commit d700abff0a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -44,6 +44,9 @@ export const fileUpload: FileUpload = ({
}
export const getFileExtension = (fileName: string, fileMimetype: string) => {
if (fileMimetype)
return mime.getExtension(fileMimetype) || ''
if (fileName) {
const fileNamePair = fileName.split('.')
const fileNamePairLength = fileNamePair.length
@ -52,9 +55,6 @@ export const getFileExtension = (fileName: string, fileMimetype: string) => {
return fileNamePair[fileNamePairLength - 1]
}
if (fileMimetype)
return mime.getExtension(fileMimetype) || ''
return ''
}