File tree Expand file tree Collapse file tree 1 file changed +15
-1
lines changed Expand file tree Collapse file tree 1 file changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -69,11 +69,25 @@ exports.getProtocol = function getProtocol (path) {
6969exports . getExtension = function getExtension ( path ) {
7070 let lastDot = path . lastIndexOf ( "." ) ;
7171 if ( lastDot >= 0 ) {
72- return path . substr ( lastDot ) . toLowerCase ( ) ;
72+ return url . stripQuery ( path . substr ( lastDot ) . toLowerCase ( ) ) ;
7373 }
7474 return "" ;
7575} ;
7676
77+ /**
78+ * Removes the query, if any, from the given path.
79+ *
80+ * @param {string } path
81+ * @returns {string }
82+ */
83+ exports . stripQuery = function stripQuery ( path ) {
84+ let queryIndex = path . indexOf ( "?" ) ;
85+ if ( queryIndex >= 0 ) {
86+ path = path . substr ( 0 , queryIndex ) ;
87+ }
88+ return path ;
89+ } ;
90+
7791/**
7892 * Returns the hash (URL fragment), of the given path.
7993 * If there is no hash, then the root hash ("#") is returned.
You can’t perform that action at this time.
0 commit comments