Repository navigation
Add a fuzzy rule canonicalising the SCP wiki's alias hosts - #424
Merged
Merged
Conversation
scp-wiki.wikidot.com, scpwiki.com, www.scpwiki.com and www.scp-wiki.net all serve the same wiki with HTTP 200 rather than a redirect, and pages link across them freely. Without canonicalisation the same article lands at several ZIM paths and cross-host links resolve to nothing: on a 10-page crawl, 30 escaped links whose target was in the ZIM under the canonical host, and SCP-4558's whole offset chain stored only under alias hosts. Driver: openzim/zim-requests#402.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #424 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 42 42
Lines 2990 2990
Branches 457 457
=========================================
Hits 2990 2990 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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.
Fixes #423, which has the full rationale and evidence.
scp-wiki.wikidot.com,scpwiki.com,www.scpwiki.comandwww.scp-wiki.netall serve the English SCP wiki with200 OKrather than a redirect, and pages link across them freely — SCP-4558's own ListPages pager points athttp://www.scp-wiki.net/scp-4558/offset/1. Without canonicalisation the same article lands at several ZIM paths and cross-host links resolve to nothing: on a 10-page crawl, 30 escaped links whose target was in the ZIM under the canonical host, and SCP-4558's whole offset chain stored only under alias hosts.Two details worth a reviewer's attention, both covered by tests:
^, unlike most rules in this file, because it rewrites the host. Sibling language branches live on subdomains of these very domains (ko.scp-wiki.net), and an unanchored match would rewrite them onto the English wiki.unreplace_patternis the never-matching(?!): the forward rule cannot know which alias a canonical URL came from, and mostscp-wiki.wikidot.comURLs were never aliased, so mapping them back would be wrong far more often than right.defuzzifythen finds no matching unrule and returns the canonical URL unchanged, in both the Python and JS implementations.