Page MenuHomePhabricator

URLs with % sign are rejected by Parsoid server
Closed, ResolvedPublic

Description

mattflaschen@terbium:~$ mwscript eval.php --wiki=mediawikiwiki
> $parsoidMethod = new ReflectionMethod( 'Flow\Parsoid\Utils::parsoid' );

> $parsoidMethod->setAccessible( true );

> echo $parsoidMethod->invoke( null, 'wikitext', 'html', '{{#useliquidthreads:1}}', Title::newFromText( 'Main_Page' ) );
<body data-parsoid='{"dsr":[0,23,0,0]}' lang="en" class="mw-content-ltr sitedir-ltr ltr mw-body mw-body-content mediawiki" dir="ltr"><span about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"dsr":[0,23,null,null],"pi":[[]]}' data-mw='{"parts":[{"template":{"target":{"wt":"#useliquidthreads:1","function":"#useliquidthreads"},"params":{},"i":0}}]}'></span></body>
> 

> echo Title::newFromText( 'Talk:Wikimedia engineering 20% policy' )->getPrefixedDBKey();
Talk:Wikimedia_engineering_20%_policy
> ^D
mattflaschen@terbium:~$ mwscript eval.php --wiki=mediawikiwiki
> $parsoidMethod = new ReflectionMethod( 'Flow\Parsoid\Utils::parsoid' );

> $parsoidMethod->setAccessible( true );

> 

> echo $parsoidMethod->invoke( null, 'wikitext', 'html', '{{#useliquidthreads:1}}', Title::newFromText( 'MediaWiki' ) );
<body data-parsoid='{"dsr":[0,23,0,0]}' lang="en" class="mw-content-ltr sitedir-ltr ltr mw-body mw-body-content mediawiki" dir="ltr"><span about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"dsr":[0,23,null,null],"pi":[[]]}' data-mw='{"parts":[{"template":{"target":{"wt":"#useliquidthreads:1","function":"#useliquidthreads"},"params":{},"i":0}}]}'></span></body>
> 

> echo $parsoidMethod->invoke( null, 'wikitext', 'html', '{{#useliquidthreads:1}}', Title::newFromText( 'Talk:Wikimedia engineering 20% policy' ) );
Caught exception Flow\Exception\NoParsoidException: Failed contacting Parsoid: There was a problem during the HTTP request: 503 Service Unavailable
#0 [internal function]: Flow\Parsoid\Utils::parsoid('wikitext', 'html', '{{#useliquidthr...', Object(Title))
#1 /srv/mediawiki/php-1.26wmf13/maintenance/eval.php(78) : eval()'d code(1): ReflectionMethod->invoke(NULL, 'wikitext', 'html', '{{#useliquidthr...', Object(Title))
#2 /srv/mediawiki/php-1.26wmf13/maintenance/eval.php(78): eval()
#3 /srv/mediawiki/multiversion/MWScript.php(97): require_once('/srv/mediawiki/...')
#4 {main}

We are using getPrefixedDBkey() form, which doesn't touch the percent sign. It's likely this is an edge case in the URL format that wasn't considered. Need to check if standard percent-encoding with urlencode will work here.

Event Timeline

Change 224198 had a related patch set uploaded (by Catrope):
urlencode titles in Parsoid URL

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

Change 224198 merged by jenkins-bot:
urlencode titles in Parsoid URL

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

Change 224218 had a related patch set uploaded (by Mattflaschen):
urlencode titles in Parsoid URL

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

Change 224218 merged by jenkins-bot:
urlencode titles in Parsoid URL

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

Special:EnableFlow is

Topics with percentage signs also displayed correctly.