Preserve original ext and skip folders when extracting extensions (#448)

This commit is contained in:
myl7
2022-02-15 19:27:47 +08:00
committed by GitHub
parent e24a602d46
commit 81d0cad71c
4 changed files with 10 additions and 7 deletions
+4 -1
View File
@@ -105,8 +105,11 @@ export function hasKey<O>(obj: O, key: PropertyKey): key is keyof O {
return key in obj
}
export function getRawExtension(fileName: string): string {
return fileName.slice(((fileName.lastIndexOf('.') - 1) >>> 0) + 2)
}
export function getExtension(fileName: string): string {
return fileName.slice(((fileName.lastIndexOf('.') - 1) >>> 0) + 2).toLowerCase()
return getRawExtension(fileName).toLowerCase()
}
export function getFileIcon(fileName: string, flags?: { video?: boolean }): [IconPrefix, IconName] {