api: url-encode UTF-8 characters in url

this encode-decode construct is ugly, but necessary to retain
backwards compatibility for weirdos that encode the URL when
passing it in via json ( like the frontend, for example. :/ )
This commit is contained in:
dumbmoron
2023-11-23 14:44:25 +00:00
parent 60743cdcdf
commit 190a0131d4
2 changed files with 2 additions and 2 deletions

View File

@@ -10,7 +10,7 @@ import hostOverrides from "./processing/hostOverrides.js";
export async function getJSON(originalURL, lang, obj) {
try {
let patternMatch, url = decodeURIComponent(originalURL),
let patternMatch, url = encodeURI(decodeURIComponent(originalURL)),
hostname = new URL(url).hostname.split('.'),
host = hostname[hostname.length - 2];