Page MenuHomePhabricator

Diff parameter without a value will take you to latest diff of main page instead of showing a warning
Open, Needs TriagePublic

Description

In MediaWiki.php we have some logic that tries to gracefully handle situations in which only some parameters are passed through query string.

However, there is one edge case in which it has an expected result (at least IMHO). Going to https://en.wikipedia.org/w/index.php?diff= will take you to the latest diff for that wiki's main page. Instead, it should show a warning that neither the title nor the diff revision ID is provided.

Details

Related Changes in Gerrit:

Event Timeline

Huji renamed this task from Diff parameter without a value will take you to a random diff to Diff parameter without a value will take you to a diff instead of showing a warning.Jul 26 2020, 2:16 AM
Huji updated the task description. (Show Details)
Huji updated the task description. (Show Details)

Instead, it should show a warning that neither the title nor the diff revision ID is provided.

why?

That is a good question, and possibly the reason this task may be declined (if declined).

My reasoning is this: https://en.wikipedia.org/w/index.php?diff= is just an incomplete URL from which a human would not understand which page or which revision is intended, so choosing both a page and a revision arbitrarily is just too many assumptions by the code.

Isn't this expected behavior? /w/index.php is the default entry point, but wmf rewrites article paths to look pretty. /w/index.php?diff= does just what I'd expect with an empty or missing parameter diff parameter: it takes you to the latest diff of the page, which, when unprovided, defaults to the main page.

Like I said, this task may be declined for that reason. I just feel like "expected" behavior is a bit subjective, and the fact that two assumptions are being made (both about the page and revision) is too liberal.

Aklapper renamed this task from Diff parameter without a value will take you to a diff instead of showing a warning to Diff parameter without a value will take you to latest diff of main page instead of showing a warning.Jul 26 2020, 8:03 PM

Change 982437 had a related patch set uploaded (by Novem Linguae; author: Novem Linguae):

[mediawiki/core@master] Invalid ?diff= now displays an error

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

Change 985107 had a related patch set uploaded (by Novem Linguae; author: Novem Linguae):

[mediawiki/core@master] Add tests for includes/MediaWiki.php

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

Change 985107 merged by jenkins-bot:

[mediawiki/core@master] Add tests for includes/MediaWiki.php

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