Don't intercept MediaWiki pages whose URL ends with .djvu (except upload.wikimedia.org) - #105
Open
frankslin wants to merge 1 commit into
Open
Don't intercept MediaWiki pages whose URL ends with .djvu (except upload.wikimedia.org)#105frankslin wants to merge 1 commit into
frankslin wants to merge 1 commit into
Conversation
The extension detects DjVu files by URL only, so HTML pages *about* a file, like https://commons.wikimedia.org/wiki/File:Foo.djvu or https://en.wikisource.org/wiki/Index:Foo.djvu, were captured as well and the viewer failed to parse them. The files themselves live on upload.wikimedia.org under /wikipedia/..., so they are still intercepted as before. - skip URLs on Wikimedia domains whose path starts with /wiki/ or /w/index.php (a higher priority "allow" rule for manifest v3, an early return for v2) - anchor the http redirect regex at the end, otherwise a partial match captured URLs like .../wiki/Page:Foo.djvu/12 and dropped the trailing part - honour a "djvu-js=off" query parameter as a manual opt-out, and offer a link with it in the viewer when a document fails to load, so that a wrongly intercepted page can be opened as a usual one Fixes RussCoder#103
Owner
|
Thank you for the PR. I will try to review it within a week. |
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.
The extension detects DjVu files by URL only, so HTML pages about a file, like https://commons.wikimedia.org/wiki/File:Foo.djvu or https://en.wikisource.org/wiki/Index:Foo.djvu, were captured as well and the viewer failed to parse them. The files themselves live on upload.wikimedia.org under /wikipedia/..., so they are still intercepted as before.
Fixes #103