From 655f9f35f76b3b4a4d7cea0d1c77caa452887feb Mon Sep 17 00:00:00 2001 From: Ming Di Leom <> Date: Wed, 8 Dec 2021 09:53:54 +0000 Subject: [PATCH] fix(utils): use path instead of full url - enables multiple hosts (e.g. onion, eepsite) to share an instance --- src/utils.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/utils.js b/src/utils.js index a53a8c9..7ac78f8 100644 --- a/src/utils.js +++ b/src/utils.js @@ -119,7 +119,7 @@ module.exports = function(redis) { href = `${protocol}${config.domain}${href}` let u = new URL(href) u.searchParams.append('lang', lang) - href = u.href + href = `${u.pathname}${u.search}` links[i].setAttribute('href', href) } } @@ -184,7 +184,7 @@ module.exports = function(redis) { // replace wiki links const wiki_href_regx = /(href=\"(https:|http:|)\/\/([A-z.-]+\.)?(wikipedia.org|wikimedia.org|wikidata.org|mediawiki.org))/gm - data.html = data.html.replace(wiki_href_regx, `href="${protocol}${config.domain}`) + data.html = data.html.replace(wiki_href_regx, 'href="') /** * If we are on DownloadAsPdf page, we have to inject a input which