]> git.ipfire.org Git - thirdparty/vuejs/router.git/commitdiff
fix: preserve fullPath when redirecting in matcher
authorEduardo San Martin Morote <posva13@gmail.com>
Wed, 29 May 2019 10:40:38 +0000 (12:40 +0200)
committerEduardo San Martin Morote <posva13@gmail.com>
Wed, 29 May 2019 10:40:38 +0000 (12:40 +0200)
__tests__/router.spec.js
src/router.ts

index da7bb5ba7bd3d8765596a93d8e766334352d6bcb..6fc4beb252334f24ca7daba5f0022d21b1e23dc7 100644 (file)
@@ -119,7 +119,7 @@ describe('Router', () => {
         hash: '#fa-2',
       })
       expect(loc.redirectedFrom).toMatchObject({
-        fullPath: '/inc-query-hash?n=2#fa',
+        fullPath: '/inc-query-hash?n=3#fa',
         path: '/inc-query-hash',
       })
     })
index 6d7e6ad219d56e752304613a7b25b078c4588124..43651ee01886fe562220c832b421a6c631f9d846 100644 (file)
@@ -90,9 +90,11 @@ export class Router {
       // target location normalized, used if we want to redirect again
       const normalizedLocation: RouteLocationNormalized = {
         ...matchedRoute.normalizedLocation,
-        fullPath: this.history.utils.stringifyURL(
-          matchedRoute.normalizedLocation
-        ),
+        fullPath: this.history.utils.stringifyURL({
+          path: matchedRoute.normalizedLocation.path,
+          query: location.query,
+          hash: location.hash,
+        }),
         query: this.history.utils.normalizeQuery(location.query || {}),
         hash: location.hash,
         redirectedFrom,