|
@@ -44,6 +44,12 @@ export const fileUpload: FileUpload = ({
|
|
|
}
|
|
|
|
|
|
export const getFileExtension = (fileName: string, fileMimetype: string, isRemote?: boolean) => {
|
|
|
+ if (fileMimetype)
|
|
|
+ return mime.getExtension(fileMimetype) || ''
|
|
|
+
|
|
|
+ if (isRemote)
|
|
|
+ return ''
|
|
|
+
|
|
|
if (fileName) {
|
|
|
const fileNamePair = fileName.split('.')
|
|
|
const fileNamePairLength = fileNamePair.length
|
|
@@ -52,12 +58,6 @@ export const getFileExtension = (fileName: string, fileMimetype: string, isRemot
|
|
|
return fileNamePair[fileNamePairLength - 1]
|
|
|
}
|
|
|
|
|
|
- if (fileMimetype)
|
|
|
- return mime.getExtension(fileMimetype) || ''
|
|
|
-
|
|
|
- if (isRemote)
|
|
|
- return ''
|
|
|
-
|
|
|
return ''
|
|
|
}
|
|
|
|
|
@@ -145,7 +145,7 @@ export const getFileNameFromUrl = (url: string) => {
|
|
|
|
|
|
export const getSupportFileExtensionList = (allowFileTypes: string[], allowFileExtensions: string[]) => {
|
|
|
if (allowFileTypes.includes(SupportUploadFileTypes.custom))
|
|
|
- return allowFileExtensions.map(item => item.toUpperCase())
|
|
|
+ return allowFileExtensions.map(item => item.slice(1).toUpperCase())
|
|
|
|
|
|
return allowFileTypes.map(type => FILE_EXTS[type]).flat()
|
|
|
}
|