GWicke has uploaded a new change for review.

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


Change subject: Encode request URL for cache requests
......................................................................

Encode request URL for cache requests

Cache requests for titles with special chars like ? were failing as the ? was
interpreted as the begin of the query string by our web API. That caused
selective serialization and expansion reuse to fail on titles like
Who_Wants_to_Be_a_Millionaire%3F_(Australian_game_show).

This patch adds percent encoding for the title, which fixes the issue.

Change-Id: I1437446961f3d7c56a4bed42a1383ed76a10d81d
---
M js/lib/mediawiki.ApiRequest.js
1 file changed, 3 insertions(+), 3 deletions(-)


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

diff --git a/js/lib/mediawiki.ApiRequest.js b/js/lib/mediawiki.ApiRequest.js
index f6f13b8..66060d6 100644
--- a/js/lib/mediawiki.ApiRequest.js
+++ b/js/lib/mediawiki.ApiRequest.js
@@ -138,7 +138,7 @@
                this._handleBody( null, body );
        } else {
                if (response.statusCode === 412) {
-                       console.warn('No cache hit for ' + this.title);
+                       console.warn('Cache MISS:', this.url);
                } else {
                        console.warn( 'non-200 response: ' + 
response.statusCode );
                        console.log( body );
@@ -523,10 +523,10 @@
                oldid: oldid
        };
        var url = env.conf.parsoid.parsoidCacheURI +
-                       env.conf.wiki.iwp + '/' + title.replace(/ /g, '_') +
+                       env.conf.wiki.iwp + '/' + 
encodeURIComponent(title.replace(/ /g, '_')) +
                        '?' + qs.stringify( apiargs );
 
-       console.log(url);
+       //console.warn('Cache request:', url);
 
 
        this.retries = 0;

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I1437446961f3d7c56a4bed42a1383ed76a10d81d
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Parsoid
Gerrit-Branch: master
Gerrit-Owner: GWicke <[email protected]>

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

Reply via email to