Last modified: 2014-11-18 18:07:27 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 T21411, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 19411 - External URL syntax cannot handle square brackets
External URL syntax cannot handle square brackets
Status: RESOLVED DUPLICATE of bug 3695
Product: MediaWiki
Classification: Unclassified
Parser (Other open bugs)
unspecified
All All
: Normal normal with 2 votes (vote)
: ---
Assigned To: Nobody - You can work on this!
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2009-06-26 13:34 UTC by Tisza Gergő
Modified: 2014-11-18 18:07 UTC (History)
2 users (show)

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


Attachments

Description Tisza Gergő 2009-06-26 13:34:30 UTC
Older PHP frameworks sometimes use square brackets to pass whole arrays as GET parameters. The external URL sytnax of MediaWiki cannot handle such links: for example, 

[http://www.danishliterature.info/index.php?id=2092&no_cache=1&tx_lfforfatter_pi2[stage]=1&tx_lfforfatter_pi2[uid]=109&tx_lfforfatter_pi2[lang]=_eng Jørgen-Frantz Jacobsen]

should give 

<a href="http://www.danishliterature.info/index.php?id=2092&no_cache=1&tx_lfforfatter_pi2[stage]=1&tx_lfforfatter_pi2[uid]=109&tx_lfforfatter_pi2[lang]=_eng">Jørgen-Frantz Jacobsen</a>

but the actual result is

<a href="http://www.danishliterature.info/index.php?id=2092&no_cache=1&tx_lfforfatter_pi2">[stage</a>=1&tx_lfforfatter_pi2[uid]=109&tx_lfforfatter_pi2[lang]=_eng Jørgen-Frantz Jacobsen]

Automatic URL have the same problem. Replacing [ and ] with %5B and %5D usually helps, but is technically incorrect because these are reserved characters and shouldn't be urlencoded (nor do most browsers urlencode them when you copy the URL from the address bar), and it depends on the whim of the url processor whether the urlencoded version will still point to the same resource.
Comment 1 Chad H. 2009-06-26 13:36:36 UTC

*** This bug has been marked as a duplicate of bug 3695 ***
Comment 2 Tisza Gergő 2009-06-26 13:57:27 UTC
Reopening, this has got nothing to do with nested links, and it is also much more severe: I see no valid use for putting a wikilink inside a normal link, but you cannot avoid putting square brackets in the URL if that is the format the target website chose to use. (Well, you can, as detailed above, but it is not guaranteed to work, and even when it does, it is unintuitive and 99% of the users will never find out on their own.)
Comment 3 Chad H. 2009-06-26 13:58:45 UTC
The naming may be different, but the issue remains the same: bad parsing of square brackets within external URL syntax.
Comment 4 Tisza Gergő 2009-06-26 14:11:39 UTC
Shall I rename 3695 to that then? Wikilinks inside external links is a "well don't do that then" issue, while this one is a serious usability problem.
Comment 5 Chad H. 2009-06-26 14:12:58 UTC
I prefer the name of this bug, actually. I say dupe this to that, and rename that one to this summary.
Comment 6 Tisza Gergő 2009-06-26 14:23:15 UTC
This one (brackets in the URL part) might be also easier to fix (or at least hack around): you can take advantage of the fact that square brackets are always balanced in an url and never at the end. Also, I have never seen an example where they are nested. It might be possible to add something like (\[[-\w_+%]*\][-\w_+%?=]+)? to the end of the URL regex to handle such links and still not mess up [1]-style automatically numbered links.
Comment 7 Tisza Gergő 2009-06-26 16:11:33 UTC

*** This bug has been marked as a duplicate of bug 3695 ***

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


Navigation
Links