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) => {
6868 return 'file' ;
6969} ;
7070export function getFileExtension ( filePath : string ) {
71- const idx = filePath . lastIndexOf ( '.' ) ;
71+ const pathWithoutParams = filePath . split ( '?' ) [ 0 ] ;
72+
73+ const idx = pathWithoutParams . lastIndexOf ( '.' ) ;
7274 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 ;
7479}
80+
7581export function normalizeFileName ( fileName : string , extension : string ) {
7682 if ( fileName . indexOf ( extension ) > - 1 ) {
7783 return fileName ;
You can’t perform that action at this time.
0 commit comments