fix bad urls containing & on fimfic site, bump version

This commit is contained in:
daniel-j 2018-10-10 09:31:39 +02:00
parent 0f77768d4f
commit b9d66d9d40
2 changed files with 3 additions and 7 deletions

View file

@ -1,6 +1,6 @@
{
"name": "fimfic2epub",
"version": "1.7.34",
"version": "1.7.35",
"description": "Tool to generate improved EPUB ebooks from Fimfiction stories",
"author": "djazz",
"license": "MIT",

View file

@ -51,12 +51,8 @@ export async function cleanMarkup (html) {
// Example: <a href="/user/djazz" rel="nofollow">djazz</a>
let matchLink = /(<a .?href=")(.+?)(".+?>)/g
html = html.replace(matchLink, (match, head, url, tail) => {
if (url.substring(0, 1) !== '#' && url.substring(0, 2) !== '//' && url.substring(0, 4) !== 'http') {
if (url.substring(0, 1) === '/') {
url = 'https://fimfiction.net' + entities.decode(url)
} else {
// do something else
}
if (url.substring(0, 1) !== '#' && url.substring(0, 2) !== '//' && url.substring(0, 4) !== 'http' && url.substring(0, 1) === '/') {
url = 'https://fimfiction.net' + url
}
return head + url + tail