mirror of
https://github.com/daniel-j/fimfic2epub.git
synced 2024-05-19 20:03:53 +12:00
fix bad urls containing & on fimfic site, bump version
This commit is contained in:
parent
0f77768d4f
commit
b9d66d9d40
|
@ -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",
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue