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(
52
52
53
53
// NOTE: we could use URL and URLSearchParams but they are 2 to 5 times slower than this method
54
54
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
62
60
63
61
if ( searchPos >= 0 ) {
64
62
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
+ )
68
68
69
69
query = parseQuery ( searchString )
70
70
}
@@ -213,7 +213,7 @@ export function resolveRelativePath(to: string, from: string): string {
213
213
return to
214
214
}
215
215
216
- // resolve '' with '/anything' -> '/anything'
216
+ // resolve to: '' with from: '/anything' -> '/anything'
217
217
if ( ! to ) return from
218
218
219
219
const fromSegments = from . split ( '/' )
You can’t perform that action at this time.
0 commit comments