]> git.ipfire.org Git - thirdparty/vuejs/router.git/commitdiff
fix: prevent error on initial navigation to //invalid
authorEduardo San Martin Morote <posva13@gmail.com>
Tue, 12 May 2020 14:39:58 +0000 (16:39 +0200)
committerEduardo San Martin Morote <posva13@gmail.com>
Tue, 12 May 2020 14:39:58 +0000 (16:39 +0200)
src/history/html5.ts

index 7318928620cd5cf43344e4fec677bcc9d4e7821e..4276caaa0301fb53a804b681f02eda7c5048404b 100644 (file)
@@ -19,6 +19,8 @@ import { stripBase } from '../location'
 
 type PopStateListener = (this: Window, ev: PopStateEvent) => any
 
+let createBaseLocation = () => location.protocol + '//' + location.host
+
 interface StateEntry extends HistoryState {
   back: HistoryLocationNormalized | null
   current: HistoryLocationNormalized
@@ -200,7 +202,7 @@ function useHistoryStateNavigation(base: string) {
     state: StateEntry,
     replace: boolean
   ): void {
-    const url = base + to.fullPath
+    const url = createBaseLocation() + base + to.fullPath
     try {
       // BROWSER QUIRK
       // NOTE: Safari throws a SecurityError when calling this function 100 times in 30 seconds