From 8e140ed6fc25d98d8cef5438f9f43bf6bc074c1c Mon Sep 17 00:00:00 2001 From: Nuri Jung Date: Sun, 17 Jul 2022 14:03:02 +0900 Subject: [PATCH] Fix for non-ascii urls --- src/client.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/client.ts b/src/client.ts index fe78e553..b2a16e76 100644 --- a/src/client.ts +++ b/src/client.ts @@ -29,9 +29,9 @@ if (attrs.theme === preferredThemeId) { // gather page attributes const canonicalLink = document.querySelector(`link[rel='canonical']`) as HTMLLinkElement; -attrs.url = canonicalLink ? canonicalLink.href : url.origin + url.pathname + url.search; -attrs.origin = url.origin; -attrs.pathname = url.pathname.length < 2 ? 'index' : url.pathname.substr(1).replace(/\.\w+$/, ''); +attrs.url = decodeURI(canonicalLink ? canonicalLink.href : url.origin + url.pathname + url.search); +attrs.origin = decodeURI(url.origin); +attrs.pathname = decodeURI(url.pathname.length < 2 ? 'index' : url.pathname.substr(1).replace(/\.\w+$/, '')); attrs.title = document.title; const descriptionMeta = document.querySelector(`meta[name='description']`) as HTMLMetaElement; attrs.description = descriptionMeta ? descriptionMeta.content : '';