parent
80b6b9966a
commit
65ec13a137
4 changed files with 18 additions and 15 deletions
|
@ -16,6 +16,7 @@ You should also include the user name that made the change.
|
||||||
|
|
||||||
### Bugfixes
|
### Bugfixes
|
||||||
- Server: Fix crash at startup if TensorFlow is not supported @mei23
|
- Server: Fix crash at startup if TensorFlow is not supported @mei23
|
||||||
|
- Client: URLエンコードされたルーティングを修正
|
||||||
|
|
||||||
## 12.112.3 (2022/07/09)
|
## 12.112.3 (2022/07/09)
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
<template>
|
<template>
|
||||||
<component :is="self ? 'MkA' : 'a'" ref="el" class="ieqqeuvs _link" :[attr]="self ? url.substr(local.length) : url" :rel="rel" :target="target"
|
<component
|
||||||
|
:is="self ? 'MkA' : 'a'" ref="el" class="ieqqeuvs _link" :[attr]="self ? url.substr(local.length) : url" :rel="rel" :target="target"
|
||||||
@contextmenu.stop="() => {}"
|
@contextmenu.stop="() => {}"
|
||||||
>
|
>
|
||||||
<template v-if="!self">
|
<template v-if="!self">
|
||||||
|
@ -23,14 +24,7 @@ import { toUnicode as decodePunycode } from 'punycode/';
|
||||||
import { url as local } from '@/config';
|
import { url as local } from '@/config';
|
||||||
import * as os from '@/os';
|
import * as os from '@/os';
|
||||||
import { useTooltip } from '@/scripts/use-tooltip';
|
import { useTooltip } from '@/scripts/use-tooltip';
|
||||||
|
import { safeURIDecode } from '@/scripts/safe-uri-decode';
|
||||||
function safeURIDecode(str: string) {
|
|
||||||
try {
|
|
||||||
return decodeURIComponent(str);
|
|
||||||
} catch {
|
|
||||||
return str;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
props: {
|
props: {
|
||||||
|
@ -42,7 +36,7 @@ export default defineComponent({
|
||||||
type: String,
|
type: String,
|
||||||
required: false,
|
required: false,
|
||||||
default: null,
|
default: null,
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
setup(props) {
|
setup(props) {
|
||||||
const self = props.url.startsWith(local);
|
const self = props.url.startsWith(local);
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
import { EventEmitter } from 'eventemitter3';
|
import { EventEmitter } from 'eventemitter3';
|
||||||
import { Ref, Component, ref, shallowRef, ShallowRef } from 'vue';
|
import { Ref, Component, ref, shallowRef, ShallowRef } from 'vue';
|
||||||
import { pleaseLogin } from '@/scripts/please-login';
|
import { pleaseLogin } from '@/scripts/please-login';
|
||||||
|
import { safeURIDecode } from '@/scripts/safe-uri-decode';
|
||||||
|
|
||||||
type RouteDef = {
|
type RouteDef = {
|
||||||
path: string;
|
path: string;
|
||||||
|
@ -116,7 +117,7 @@ export class Router extends EventEmitter<{
|
||||||
}
|
}
|
||||||
if (p.wildcard) {
|
if (p.wildcard) {
|
||||||
if (parts.length !== 0) {
|
if (parts.length !== 0) {
|
||||||
props.set(p.name, parts.join('/'));
|
props.set(p.name, safeURIDecode(parts.join('/')));
|
||||||
parts = [];
|
parts = [];
|
||||||
}
|
}
|
||||||
break pathMatchLoop;
|
break pathMatchLoop;
|
||||||
|
@ -124,10 +125,10 @@ export class Router extends EventEmitter<{
|
||||||
if (p.startsWith) {
|
if (p.startsWith) {
|
||||||
if (parts[0] == null || !parts[0].startsWith(p.startsWith)) continue forEachRouteLoop;
|
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();
|
parts.shift();
|
||||||
} else {
|
} else {
|
||||||
props.set(p.name, parts[0]);
|
props.set(p.name, safeURIDecode(parts[0]));
|
||||||
parts.shift();
|
parts.shift();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -137,7 +138,7 @@ export class Router extends EventEmitter<{
|
||||||
if (parts.length !== 0) continue forEachRouteLoop;
|
if (parts.length !== 0) continue forEachRouteLoop;
|
||||||
|
|
||||||
if (route.hash != null && hash != null) {
|
if (route.hash != null && hash != null) {
|
||||||
props.set(route.hash, hash);
|
props.set(route.hash, safeURIDecode(hash));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (route.query != null && queryString != null) {
|
if (route.query != null && queryString != null) {
|
||||||
|
@ -147,7 +148,7 @@ export class Router extends EventEmitter<{
|
||||||
for (const q in route.query) {
|
for (const q in route.query) {
|
||||||
const as = route.query[q];
|
const as = route.query[q];
|
||||||
if (queryObject[q]) {
|
if (queryObject[q]) {
|
||||||
props.set(as, queryObject[q]);
|
props.set(as, safeURIDecode(queryObject[q]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
7
packages/client/src/scripts/safe-uri-decode.ts
Normal file
7
packages/client/src/scripts/safe-uri-decode.ts
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
export function safeURIDecode(str: string): string {
|
||||||
|
try {
|
||||||
|
return decodeURIComponent(str);
|
||||||
|
} catch {
|
||||||
|
return str;
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in a new issue