Page MenuHomePhabricator

%25foo is a legal article title, but %25bar is not
Closed, DeclinedPublic

Description

Steps to reproduce:

  1. Browse to https://cy.wikipedia.org/wiki/%25foo .
  2. Then browse to https://cy.wikipedia.org/wiki/%25bar .

Expected behaviour: Both titles should be illegal. (Or both should be legal, but I guess that's messier).

Observed behaviour: %25foo , but %25bar is not.

It seems titles containing %25 are illegal if they match /%25[0-9A-Fa-f][0-9A-Fa-f]/ . I guess this prohibition may be because parts of mediawiki are rather fluid about transparently encoding/decoding URI components, in which case this might not be easy to fix.

Event Timeline

Works as designed (see MediaWikiTitleCodec::getTitleInvalidRegex)

			# Matching titles will be held as illegal.
			$rxTc = '/' .
				# Any character not allowed is forbidden...
				'[^' . Title::legalChars() . ']' .
				# URL percent encoding sequences interfere with the ability
				# to round-trip titles -- you can't link to them consistently.
				'|%[0-9A-Fa-f]{2}' .
				# XML/HTML character references produce similar issues.
				'|&[A-Za-z0-9\x80-\xff]+;' .
				'|&#[0-9]+;' .
				'|&#x[0-9A-Fa-f]+;' .
				'/S';

Why change this?

Why change this?

No reply, hence closing as declined.