From ad970dffdabb7b81ee18583c86898f48df0b4302 Mon Sep 17 00:00:00 2001 From: syuilo Date: Wed, 13 Jul 2022 18:11:54 +0900 Subject: fix(client): fix url encoded string handling of nirax Fix #8878 --- packages/client/src/nirax.ts | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'packages/client/src/nirax.ts') diff --git a/packages/client/src/nirax.ts b/packages/client/src/nirax.ts index cd29ae87a5..7587901d70 100644 --- a/packages/client/src/nirax.ts +++ b/packages/client/src/nirax.ts @@ -3,6 +3,7 @@ import { EventEmitter } from 'eventemitter3'; import { Ref, Component, ref, shallowRef, ShallowRef } from 'vue'; import { pleaseLogin } from '@/scripts/please-login'; +import { safeURIDecode } from '@/scripts/safe-uri-decode'; type RouteDef = { path: string; @@ -116,7 +117,7 @@ export class Router extends EventEmitter<{ } if (p.wildcard) { if (parts.length !== 0) { - props.set(p.name, parts.join('/')); + props.set(p.name, safeURIDecode(parts.join('/'))); parts = []; } break pathMatchLoop; @@ -124,10 +125,10 @@ export class Router extends EventEmitter<{ if (p.startsWith) { if (parts[0] == null || !parts[0].startsWith(p.startsWith)) continue forEachRouteLoop; - props.set(p.name, parts[0].substring(p.startsWith.length)); + props.set(p.name, safeURIDecode(parts[0].substring(p.startsWith.length))); parts.shift(); } else { - props.set(p.name, parts[0]); + props.set(p.name, safeURIDecode(parts[0])); parts.shift(); } } @@ -137,7 +138,7 @@ export class Router extends EventEmitter<{ if (parts.length !== 0) continue forEachRouteLoop; if (route.hash != null && hash != null) { - props.set(route.hash, hash); + props.set(route.hash, safeURIDecode(hash)); } if (route.query != null && queryString != null) { @@ -147,7 +148,7 @@ export class Router extends EventEmitter<{ for (const q in route.query) { const as = route.query[q]; if (queryObject[q]) { - props.set(as, queryObject[q]); + props.set(as, safeURIDecode(queryObject[q])); } } } -- cgit v1.2.3-freya