File tree Expand file tree Collapse file tree 1 file changed +8
-2
lines changed
packages/uikit-utils/src/shared Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -68,10 +68,16 @@ export const getFileType = (extOrType: string) => {
68
68
return 'file' ;
69
69
} ;
70
70
export function getFileExtension ( filePath : string ) {
71
- const idx = filePath . lastIndexOf ( '.' ) ;
71
+ const pathWithoutParams = filePath . split ( '?' ) [ 0 ] ;
72
+
73
+ const idx = pathWithoutParams . lastIndexOf ( '.' ) ;
72
74
if ( idx === - 1 ) return '' ;
73
- return filePath . slice ( idx - filePath . length ) . toLowerCase ( ) ;
75
+
76
+ const result = pathWithoutParams . slice ( idx - pathWithoutParams . length ) . toLowerCase ( ) ;
77
+ if ( result === '.' ) return '' ;
78
+ else return result ;
74
79
}
80
+
75
81
export function normalizeFileName ( fileName : string , extension : string ) {
76
82
if ( fileName . indexOf ( extension ) > - 1 ) {
77
83
return fileName ;
You can’t perform that action at this time.
0 commit comments