We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent ff2e3e5 commit b67e094Copy full SHA for b67e094
packages/core/src/ref-utils.ts
@@ -41,6 +41,8 @@ export class Location {
41
}
42
43
export function unescapePointerFragment(fragment: string): string {
44
+ if (fragment.indexOf('~') === -1) return fragment;
45
+
46
const unescaped = fragment.replace(/~1/g, '/').replace(/~0/g, '~');
47
48
try {
@@ -52,6 +54,8 @@ export function unescapePointerFragment(fragment: string): string {
52
54
53
55
export function escapePointerFragment<T extends string | number>(fragment: T): T {
56
if (typeof fragment === 'number') return fragment;
57
+ if (fragment.indexOf('/') === -1 && fragment.indexOf('~') === -1) return fragment;
58
59
return fragment.replaceAll('~', '~0').replaceAll('/', '~1') as T;
60
61
0 commit comments