mirror of
https://github.com/alexadam/save-as-ebook.git
synced 2025-09-10 01:15:09 +00:00
fix issue #22 - relative image url's starting with / are not saved
This commit is contained in:
parent
39b66f2f8c
commit
782e96340e
1 changed files with 10 additions and 0 deletions
|
@ -166,6 +166,9 @@ function getAbsoluteUrl(urlStr) {
|
|||
var originUrl = getOriginUrl();
|
||||
var absoluteUrl = urlStr;
|
||||
|
||||
originUrl = removeEndingSlash(originUrl)
|
||||
currentUrl = removeEndingSlash(currentUrl)
|
||||
|
||||
if (urlStr.indexOf('//') === 0) {
|
||||
absoluteUrl = window.location.protocol + urlStr;
|
||||
} else if (urlStr.indexOf('/') === 0) {
|
||||
|
@ -183,6 +186,13 @@ function getAbsoluteUrl(urlStr) {
|
|||
}
|
||||
}
|
||||
|
||||
function removeEndingSlash(inputStr) {
|
||||
if (inputStr.endsWith('/')) {
|
||||
return inputStr.substring(0, inputStr.length - 2);
|
||||
}
|
||||
return inputStr;
|
||||
}
|
||||
|
||||
// https://gist.github.com/jonleighton/958841
|
||||
function base64ArrayBuffer(arrayBuffer) {
|
||||
var base64 = '';
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue