Last modified: 2013-04-15 20:58:16 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T27353, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 25353 - Url escapement in JSON
Url escapement in JSON
Status: RESOLVED FIXED
Product: MediaWiki
Classification: Unclassified
API (Other open bugs)
unspecified
All All
: Lowest enhancement (vote)
: ---
Assigned To: Roan Kattouw
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2010-09-28 19:23 UTC by DieBuche
Modified: 2013-04-15 20:58 UTC (History)
6 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description DieBuche 2010-09-28 19:23:39 UTC
Ok, maybe I'm missing some thing really obvious; but:
Why are all / in URLs (for example the url given out by image info) escaped with a \ when format=json?
/ is no special character in JSON, the only one which needs escapement is "

Sample Query: http://en.wikipedia.org/w/api.php?action=query&format=json&titles=Image:Test.jpg&prop=imageinfo&iiprop=url

Result: [...] "url":"http:\/\/upload.wikimedia.org\/wikipedia\/en\/b\/bd\/Test.jpg" [...]
Comment 1 Roan Kattouw 2010-09-28 19:27:25 UTC
PHP's json_encode() function does this, no idea why:

> echo json_encode(array('foo' => 'http://en.wikipedia.org/w/api.php'));
{"foo":"http:\/\/en.wikipedia.org\/w\/api.php"}

Marking WONTFIX cause we're using a library implementation that we can reasonably expect not to be stupid (and that at least isn't generating invalid JSON).
Comment 2 Kevin Israel (PleaseStand) 2013-04-15 20:58:16 UTC
Fixed in Gerrit change #50140. Now, on PHP 5.3, str_replace is used to remove the unnecessary backslashes, and on PHP 5.4, the JSON_UNESCAPED_SLASHES flag is used.

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links