From deea197ca727104b4ba9e215933d3d2b3ffb5c75 Mon Sep 17 00:00:00 2001 From: Igor Kushnir Date: Sun, 28 Jan 2018 22:15:03 +0200 Subject: [PATCH] Fix subpage links in MediaWiki I haven't encountered any prefix other than "/wiki/" that should be discarded. If there are such other prefixes, I think they would conform to some pattern, and so the replacement code could be adjusted to accommodate them. This commit fixes #813. Examples of pages with subpage links in English Wikipedia that are fixed by this commit: "Asio (disambiguation)", "Asio C plus plus library". This issue is much more prevalent in Wookieepedia because it has a two-tab link system with the patterns */Legends and */Canon. --- mediawiki.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mediawiki.cc b/mediawiki.cc index 705cf269..8a433db0 100644 --- a/mediawiki.cc +++ b/mediawiki.cc @@ -411,8 +411,8 @@ void MediaWikiArticleRequest::requestFinished( QNetworkReply * r ) //fix src="/foo/bar/Baz.png" articleString.replace( "src=\"/", "src=\"" + wikiUrl.toString() ); - // Replace the href="/foo/bar/Baz" to just href="Baz". - articleString.replace( QRegExp( "]*(upload\\.wikimedia\\.org/wikipedia/commons/[^\"'&]*\\.ogg)[^>]*>\\s*<[^<]*"),