Fix: crash of workflow file upload (#10831)

Co-authored-by: -LAN- <laipz8200@outlook.com>
Co-authored-by: StyleZhang <jasonapring2015@outlook.com>
This commit is contained in:
KVOJJJin
2024-11-19 14:15:18 +08:00
committed by GitHub
parent 133de9a087
commit 328965ed7c
9 changed files with 65 additions and 24 deletions

View File

@@ -44,21 +44,24 @@ export const fileUpload: FileUpload = ({
}
export const getFileExtension = (fileName: string, fileMimetype: string, isRemote?: boolean) => {
let extension = ''
if (fileMimetype)
return mime.getExtension(fileMimetype) || ''
extension = mime.getExtension(fileMimetype) || ''
if (isRemote)
return ''
if (fileName) {
if (fileName && !extension) {
const fileNamePair = fileName.split('.')
const fileNamePairLength = fileNamePair.length
if (fileNamePairLength > 1)
return fileNamePair[fileNamePairLength - 1]
extension = fileNamePair[fileNamePairLength - 1]
else
extension = ''
}
return ''
if (isRemote)
extension = ''
return extension
}
export const getFileAppearanceType = (fileName: string, fileMimetype: string) => {