Cscott has uploaded a new change for review.

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


Change subject: Fix %xx normalization in parserTests.
......................................................................

Fix %xx normalization in parserTests.

In commit 73aef888223820cedded89523177c361ef3d3ec3 I attempted to fix this,
but I used the wrong function, with the result that UTF-8 characters were
mangled.  decodeURIComponent does the proper UTF-8 decoding.  One more
test passes!

Change-Id: Ib36863fcb791b515a887c7d360602c584fc13220
---
M js/lib/mediawiki.Util.js
M js/tests/parserTests-blacklist.js
2 files changed, 2 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Parsoid 
refs/changes/10/60910/1

diff --git a/js/lib/mediawiki.Util.js b/js/lib/mediawiki.Util.js
index a96a96e..2391e02 100644
--- a/js/lib/mediawiki.Util.js
+++ b/js/lib/mediawiki.Util.js
@@ -1019,7 +1019,7 @@
                .replace(/<span><\/span>/g, '')
                .replace(/(href=")(?:\.?\.\/)+/g, '$1')
                // replace unnecessary URL escaping
-               .replace(/ href="[^"]*"/g, unescape)
+               .replace(/ href="[^"]*"/g, decodeURIComponent)
                // strip thumbnail size prefixes
                
.replace(/(src="[^"]*?)\/thumb(\/[0-9a-f]\/[0-9a-f]{2}\/[^\/]+)\/[0-9]+px-[^"\/]+(?=")/g,
 '$1$2')
                .replace(/(<(table|tbody|tr|th|td|\/th|\/td)[^<>]*>)\s+/g, 
'$1');
@@ -1059,7 +1059,7 @@
                        .replace(/href="\/wiki\//g, 'href="')
                        .replace(/" +>/g, '">')
                        // replace unnecessary URL escaping
-                       .replace(/ href="[^"]*"/g, unescape)
+                       .replace(/ href="[^"]*"/g, decodeURIComponent)
                        // strip empty spans
                        .replace(/<span><\/span>/g, '')
                        
.replace(/(<(table|tbody|tr|th|td|\/th|\/td)[^<>]*>)\s+/g, '$1');
diff --git a/js/tests/parserTests-blacklist.js 
b/js/tests/parserTests-blacklist.js
index 251e664..db817f8 100644
--- a/js/tests/parserTests-blacklist.js
+++ b/js/tests/parserTests-blacklist.js
@@ -636,7 +636,6 @@
 // Blacklist for html2html
 add("html2html", "Paragraphs with newline spacing with non-empty white-space 
lines in between");
 add("html2html", "Paragraphs with newline spacing with non-empty mixed comment 
and white-space lines in between");
-add("html2html", "Parsing an URL");
 add("html2html", "Italics and bold");
 add("html2html", "Italics and possessives");
 add("html2html", "Italics and bold: 2-quote opening sequence: (2,5) 
(parsoid)");

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ib36863fcb791b515a887c7d360602c584fc13220
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/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