Cscott has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/171858

Change subject: Properly escape question marks in page titles in <head>.
......................................................................

Properly escape question marks in page titles in <head>.

The unescaped question mark in the <base href> caused OCG problems
on the page
[[:enwikibooks:A-level Physics (Advancing Physics)/What is a wave?/Worked 
Solutions]]
and it turns out that the RDF isVersionOf property link had the same
buglet.

Change-Id: I0f1b92ba569d82832038ccbc5cd722d6d9cb1aaf
---
M lib/mediawiki.DOMPostProcessor.js
M tests/parserTests.txt
2 files changed, 13 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/services/parsoid 
refs/changes/58/171858/1

diff --git a/lib/mediawiki.DOMPostProcessor.js 
b/lib/mediawiki.DOMPostProcessor.js
index c161b02..b41b663 100644
--- a/lib/mediawiki.DOMPostProcessor.js
+++ b/lib/mediawiki.DOMPostProcessor.js
@@ -324,7 +324,8 @@
                'property': 'mw:parsoidVersion',
                'content': env.conf.parsoid.version.toString()
        });
-       var wikiPageUrl = env.conf.wiki.baseURI + env.page.name;
+       var wikiPageUrl = env.conf.wiki.baseURI +
+               env.page.name.split('/').map(encodeURIComponent).join('/');
        appendToHead(document, 'link',
                { rel: 'dc:isVersionOf', href: wikiPageUrl });
 
diff --git a/tests/parserTests.txt b/tests/parserTests.txt
index 628d3cb..e02e46f 100644
--- a/tests/parserTests.txt
+++ b/tests/parserTests.txt
@@ -21676,6 +21676,17 @@
 !! end
 
 !! test
+Links when there are question marks in the page title
+!! options
+title=[[A/B?/C]]
+parsoid=wt2html
+!! wikitext
+[[Foo]]
+!! html/parsoid
+<p><a rel="mw:WikiLink" href="../../../Foo" title="Foo">Foo</a></p>
+!! end
+
+!! test
 Image: Modifying size of an image (1)
 !! options
 parsoid={

-- 
To view, visit https://gerrit.wikimedia.org/r/171858
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I0f1b92ba569d82832038ccbc5cd722d6d9cb1aaf
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/services/parsoid
Gerrit-Branch: master
Gerrit-Owner: Cscott <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to