Page MenuHomePhabricator

URL to pagenames with special characters fail
Closed, DuplicatePublic

Description

when using the /wiki/<pagename> URL format, adding parameters (such as ?redirect=no) fails when the pagename includes special characters, like '?'. This occurs even when the special character is correctly URL-encoded. For example:

https://en.wikipedia.org/wiki/%3f follows the redirect to https://en.wikipedia.org/wiki/Question_mark, as expected. (%3f is the url-encoded question mark character, of course)

https://en.wikipedia.org/wiki/Statistical_test?redirect=no does *not* follow the redirect to https://en.wikipedia.org/wiki/Statistical_hypothesis_testing; it remains at the Statistical test redirect, which is again expected.

However, https://en.wikipedia.org/wiki/%3f?redirect=no *does* follow the redirect to https://en.wikipedia.org/wiki/Question_mark, which is *not* expected. This is despite the fact that the first question mark is correctly URL-encoded. The final URL that we end up at appears in the browser bar as https://en.wikipedia.org/w/index.php?title=Question_mark&%3Fredirect=no.

Similarly, https://en.wikipedia.org/wiki/User:Writ_Keeper/sandbox%3Fsandbox?redirect=no also incorrectly follows the redirect to User:Writ_Keeper/sandbox; the final URL there ends up as https://en.wikipedia.org/w/index.php?title=User:Writ_Keeper/sandbox&sandbox%3Fredirect=no

It would seem that the URL is being decoded before the URL parameters are deciphered.

Event Timeline

I would say this is functioning as intended all /wiki urls are in the short url form. Short urls do not handle any URL params. index.php is the correct access point for URLs that need params passed.

Fair enough, I suppose--I was surprised that redirect=no worked with the short form at all--but then, does that make the fact that it *does* work a bug in itself?

Beaten to the punch, but ditto them for me (well, not ve, but the others). It seems inconsistent to accept all others while rejecting redirect= in some cases. The preferred use case would be the ability to add an arbitrary query to a "pretty" URL.

@Unready: this bug actually applies to all URL parameters, not just redirect, given a page name with a question mark in it. For example:

https://en.wikipedia.org/wiki/User:Writ_Keeper/sandbox%3fsandbox?action=history; this should take you to the history of the page [[User:Writ Keeper/sandbox?sandbox]], but instead it just ignores the url params and follows the redirect to [[User:Writ Keeper/sandbox]].

I appreciate Betacommand's point that these URL parameters shouldn't necessarily be valid for shortened urls, but one way or another, I would expect the user experience to be consistent; either always accept url params or never accept them. That we sometimes parse and use them and sometimes don't seems like a bug to me, regardless of which of those two is the expected behavior.

Ottomata subscribed.

Pretty sure there is no operations action item here, so removing tag.

This is a misconfiguration of Wikipedia's short URLs. Correctly configured MediaWiki does not exhibit this issue, I can't reproduce locally. Sounds like Operations to me. Should it be under some different project than Wikimedia-Apache-configuration?

@matmarex, perhaps, but what I'm reading is that folks think that MW should handle short URLs with query params consistently, which isn't operations. Not sure though.

MediaWiki already does it consistently and correctly, but it can't if it doesn't have access to the unmangled URL. Something in our server setup mangles the URLs irrecoverably, as described in parent task T132629.

Should this be merged into the parent task then?

Maybe? I guess it's a special case of that. Do whatever makes it easier for you folks to get it fixed :)

Ha, I'm not sure it'll help get it fixed, but it will help with ticket proliferation :)