Brion Vibber wrote:
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
Roan Kattouw wrote:
Brion Vibber schreef:
At this point it probably makes sense to go ahead and refactor this check & transformation into Title::newFromText itself -- it's already doing character reference decoding, so tossing in a URL decode doesn't sound too out of bounds, and it'll keep behavior consistent.
I have the feeling that that'll spawn some nasty bugs relating to pages with literal "%28" etc. in them.
There are none, as that's been forbidden for a long time (since you can't round-trip them safely).
Literal % *is* allowed, but only when not followed by two hex digits.
Another corner case we need to consider is titles containing both "%" and "+", since urldecode() turns plus signs into spaces. Actually, the current behavior is arguably somewhat broken already (try typing the string "[[50% + 50% = 100%]]" into a wiki page and hit preview) but at least we should be careful not to break it any further.
Maybe the fix should be to only trigger the URL-decoding if the text matches /%[0-9A-fa-z]{2}/ rather than whenever it has a "%" sign in it.