alexadam / save-as-ebook

Save a web page/selection as an eBook (.epub format) - a Chrome/Firefox/Opera Web Extension
MIT License
1.1k stars 70 forks source link

fix wrong base url when base tag exists #64

Open bunglegrind opened 2 years ago

bunglegrind commented 2 years ago

When base tag https://developer.mozilla.org/en-US/docs/Web/HTML/Element/base exists, relative urls (i.e. images) are not calculated correctly. For instance try to export the angularJS guide:

https://docs.angularjs.org/guide/databinding

This PR fixes the issue by including a check for the base tag, renaming the function getCurrentUrl in the more appropriate getBaseUrl and removing the relative field from the response object in extractHtml, since it's unused.