File tree Expand file tree Collapse file tree 1 file changed +11
-11
lines changed Expand file tree Collapse file tree 1 file changed +11
-11
lines changed Original file line number Diff line number Diff line change @@ -52,19 +52,19 @@ export function parseURL(
5252
5353 // NOTE: we could use URL and URLSearchParams but they are 2 to 5 times slower than this method
5454 const hashPos = location . indexOf ( '#' )
55- // let searchPos = location.indexOf('?')
56- let searchPos =
57- hashPos >= 0
58- ? // find the query string before the hash to avoid including a ? in the hash
59- // e.g. /foo#hash?query -> has no query
60- location . lastIndexOf ( '?' , hashPos )
61- : location . indexOf ( '?' )
55+ let searchPos = location . indexOf ( '?' )
56+
57+ // This ensures that the ? is not part of the hash
58+ // e.g. /foo#hash?query -> has no query
59+ searchPos = hashPos >= 0 && searchPos > hashPos ? - 1 : searchPos
6260
6361 if ( searchPos >= 0 ) {
6462 path = location . slice ( 0 , searchPos )
65- searchString =
66- '?' +
67- location . slice ( searchPos + 1 , hashPos > 0 ? hashPos : location . length )
63+ // keep the ? char
64+ searchString = location . slice (
65+ searchPos ,
66+ hashPos > 0 ? hashPos : location . length
67+ )
6868
6969 query = parseQuery ( searchString )
7070 }
@@ -213,7 +213,7 @@ export function resolveRelativePath(to: string, from: string): string {
213213 return to
214214 }
215215
216- // resolve '' with '/anything' -> '/anything'
216+ // resolve to: '' with from: '/anything' -> '/anything'
217217 if ( ! to ) return from
218218
219219 const fromSegments = from . split ( '/' )
You can’t perform that action at this time.
0 commit comments