Page MenuHomePhabricator

Flow: Remove square brackets ("[" and "]") from Flow-related URLs
Closed, ResolvedPublic

Description

Don't use square brackets in urls - many email programs and IRC programs will break the link, and wikis will incorrectly interpret it. (Also avoid round brackets, and quotation marks, if possible)

eg. http://ee-flow.wmflabs.org/w/index.php?title=Talk:Flow_workshop&topic[postId]=0506fd0ed2010e132562fa163e68c4ac&workflow=0506fc4aad826e5b09a3fa163e68c4ac&action=edit-post


Version: unspecified
Severity: normal

Details

Reference
bz56196

Event Timeline

bzimport raised the priority of this task from to High.Nov 22 2014, 2:38 AM
bzimport set Reference to bz56196.
bzimport added a subscriber: Unknown Object (MLST).

The WMF core features team tracks this bug on Mingle card https://mingle.corp.wikimedia.org/projects/flow/cards/363, but people from the community are welcome to contribute here and in Gerrit.

Unable to reproduce.

I looked at a few URLs displayed in the interface, and they're all escaped correctly.

Where did you get this link?

Andrew and S can't reproduce, so closed in Mingle, and here.

ErikB says square brackets are the way that MediaWiki can pass array arguments in URLs, that's a good reason to use them.

Reopening; S, you reproduced an example of this kind of URL in bug #56300 ;p

(In reply to comment #9)

Another group of unescaped brackets, found in all "comment" links in history
pages, eg.

http://ee-flow.wmflabs.org/w/index.php?title=User_talk:
Quiddity&workflow=0506915cf3d0b62ef835fa163e68c4ac&action=topic-history

If I View > Source of that page, or select "added a comment" and View > Selection Source, I see %5B and %5D in the HTML, not square brackets.

(In reply to comment #10)

Also in diffs, eg

Again, if you View > Source the URLs of the "history page" and "20 days ago" links contain %5B and %5D, not brackets.

Note that when you mouse over these, and when you copy and paste them, your browser shows you '[' and ']' in place of the %5B and %5D -- try it with the URL in comment #8 -- so it's hard to tell what's going on. View > Source.

(In reply to comment #11)
That seems like a bug. The hyperlink ends at the square brackets. I don't know if Flow should be escaping URLs before submitting to Parsoid or if Parsoid is doing something wrong.

Another example: https://www.mediawiki.org/w/index.php?title=Talk:Flow&topic[postId]=050f90d90ce1662828ca90b11c28d444&workflow=050f6a5c16971e9b25a890b11c27a364

Please do not use [ and ] in the URL. This breaks wikimarkup (try making an external link with the URL above in it) and is just generally ugly and bad. The use of [ and ] in URLs is definitely a valid bug.

Change 110501 had a related patch set uploaded by EBernhardson:
Switch to underscores, because php mangles everything else

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

Change 110501 merged by jenkins-bot:
Switch to underscores, because php mangles everything else

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

This fix on ee-flow is causing problems in mini-pencil > Show changes links, see bug 60947

Links with topic[postId] in their URL are still present in Special:RecentChanges, specifically its "full-date" and "|post)" links. E.g.

http://ee-flow.wmflabs.org/w/index.php?title=User_talk:Maryana&workflow=rmk2kkoa3x4tnzsq&topic%5BpostId%5D=rmk2kkoa3x4tnzsq&action=post-history

The issue might lie in postLink() and postHistoryLink() in includes/Formatter/AbstractFormatter.php, which pass

'topic' => array( 'postId'

to UrlGenerator->buildUrl , maybe they should call generateBlockUrl() and a version that permits a particular action

Change 120732 had a related patch set uploaded by Bsitu:
Remove [] from URL

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

Change 120732 merged by jenkins-bot:
Remove [] from URL

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