Fix invalid URL errors that prevent loading more than 2 pages#7
Open
KarolS wants to merge 3 commits into
Open
Conversation
Manga Loader on Mangafox on Firefox failed to load more than 2 pages, since it attempted to load `3.html` which is not a valid URL. This commit patches it.
fuzetsu
reviewed
Dec 14, 2017
| return elem.href || elem.getAttribute('href'); | ||
| var href = elem.href || elem.getAttribute('href'); | ||
| if (!href.startsWith('//') && !href.startsWith('http') && !href.startsWith('#')) { | ||
| return window.location.href + "/../" + href; |
Owner
There was a problem hiding this comment.
I might be missing something here, but is this code specific to Mangafox? Since this change is in the centrally used extractInfo function couldn't it affect a site that returns relative URLs. My main concern is the /../.
Contributor
Author
There was a problem hiding this comment.
At least Firefox and Chrome normalize such sequences in URLs. See also https://tools.ietf.org/html/rfc3986#section-6.2.2.3
But you were right that it's not the best way to fix relative URL's, so I sat down for a while more and improved it.
Bato.to still doesn't work though.
Mangahere loads page 3 without the protocol in the URL
There are the following cases to derelativise: * //a – just add the protocol to get https://a * /b – just add the host to get http://a/b * b – take everything up to the last slash of the path (the root document always has an implicit slash, so it's fine) from the current URL and add the relative URL – so http://a/b/ + c = http://a/b/c but http://a/b + c = http://a/c
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Manga Loader on Mangafox on Firefox failed to load more than 2 pages, since it attempted to load
3.htmlwhich is not a valid URL. This commit patches it.