Page MenuHomePhabricator

404 page is wrong on sister projects when path starts with /w/
Open, LowPublic

Description

Visiting https://en.wiktionary.org/w/r/t yields the attached.

Note the link to Wikipedia. However, https://en.wiktionary.org/foo works, so it's probably related to the fact that there's a real /w URL path.

The above is fixed; see T56357#574876 for remaining issues


See Also: T37052: Wikimedia 404 error page shouldn't use a Refresh HTTP header to implement the auto-redirect to /wiki

Details

Reference
bz54357

Event Timeline

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

I've tidied up the file and removed some of the ancient unused code paths

The problem code is in this area:

if( preg_match( "|(%2f)|i", $loc, $matches )

preg_match( "^/upload/(.*)i",$loc, $matches )
preg_match("^/style/(.*)i",$loc, $matches )
preg_match( "^/wiki/(.*)i",$loc, $matches )
preg_match("^/w/(.*)i",$loc, $matches )
preg_match( "^/extensions/(.*)i",$loc, $matches )

) {
$title = htmlspecialchars( $matches[1] );
$details = "<p style=\"font-weight: bold;\">To check for \"$title\" on Wikipedia, see:

				<a href=\"//en.wikipedia.org/wiki/$title\" title=\"Wikipedia:$title\">
				//en.wikipedia.org/wiki/$title</a></p>";

} else {
$target = $prot . $serv . "/wiki" . $loc;
$encTarget = htmlspecialchars( $target );
header( "Refresh: 5; url=$encTarget" );
$details="<p><b>Did you mean to type <a href=$encTarget>$encTarget</a>?</b>

			  You will be automatically redirected there in five seconds.</p>";

}

Change 85380 had a related patch set uploaded by Reedy:
404 page is wrong on sister projects when path starts with /w/

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

Change 85380 merged by Reedy:
404 page is wrong on sister projects when path starts with /w/

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

(In reply to comment #5)

not fixed AFAICT

The example in my report (https://en.wiktionary.org/w/r/t) works. It shows the correct 404 page, linking to https://en.wiktionary.org/wiki/r/t, just as https://en.wikipedia.org/w/r/t links to https://en.wikipedia.org/wiki/r/t

Is there a similar example that still points to the wrong place on a sister project?

You said yields the "attached" but I see no attachment.

Is "/w/r/t" not supposed to go to /wiki/w/r/t ? ( https://en.wiktionary.org/wiki/WRT )

I agree with Jeremy that the current behavior isn't ideal. If a user visits https://en.wiktionary.org/w/o, he or she is currently prompted with:


To check for "o" see: https://en.wiktionary.org/wiki/o

This should be:


To check for "w/o" see: https://en.wiktionary.org/wiki/w/o

Perhaps we should special-case "w/"? This may be the subject of a separate (future) bug report, but it certainly seems like a valid bug to me.

You're right, I forgot to attach it (nor does it look like I took it). The issue was just that it linked to Wikipedia instead of Wiktionary.

It's not clear what the correct behavior is. I agree in those examples, adding just /wiki would be better (e.g. https://en.wiktionary.org/wiki/w/o).

But it's quite possible someone could visit https://en.wikipedia.org/w/John%20Smith, in which case the current behavior is ideal (converting /w to /wiki).

Aklapper lowered the priority of this task from Medium to Low.Jul 24 2022, 3:27 PM
Aklapper updated the task description. (Show Details)