Merge pull request 'fix(utils): use path instead of full url' (#27) from curben/Wikiless:path into main

Reviewed-on: https://codeberg.org/orenom/Wikiless/pulls/27
This commit is contained in:
orenom
2021-12-12 22:50:03 +01:00
+2 -2
View File
@@ -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