Page MenuHomePhabricator

ImagePage: OutputPage::setFileVersion not called in diff view
Closed, DeclinedPublic

Description

The 'ImagePage' calls the 'setFileVersion' of the current 'OutputPage' object only at the end of method 'openShowImage' [1]. But this method just gets called if the page is not in 'diff' view [2].

Why is this a problem?
In core there is afaik no use of the 'fileVersion' field of 'OutputPage'. But there are extensions that rely on this information. A famous example is the FlaggedRevs extension, which uses this field to populate the review HTML form with hidden fields [3]. The described behavior results in a bad parametrized HTML form and therefore in a broken functionality.

What is a possible soultion?
One could just move the call of 'OutputPage::setFileVersion' out of 'ImagePage::openShowImage' and into 'ImagePage::view'

[1] http://git.wikimedia.org/blob/mediawiki%2Fcore.git/251b345151a1ce517d9f06f9bfa18d520a6c7e5a/includes%2Fpage%2FImagePage.php#L621
[2] http://git.wikimedia.org/blob/mediawiki%2Fcore.git/251b345151a1ce517d9f06f9bfa18d520a6c7e5a/includes%2Fpage%2FImagePage.php#L153
[3] http://git.wikimedia.org/blob/mediawiki%2Fextensions%2FFlaggedRevs.git/0057d275a4903ebd8750bbeabee4b69affecf48b/frontend%2FFlaggablePageView.php#L1138

Event Timeline

Osnard raised the priority of this task from to Needs Triage.
Osnard updated the task description. (Show Details)
Osnard subscribed.
Aklapper added a project: Technical-Debt.
Aklapper set Security to None.

Added a change set to gerrit. Just in case somebody is interested.

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

Change 306664 had a related patch set uploaded (by Legoktm):
Ensure OutputPage::setFileVersion() is called in diff view

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

Change 306664 abandoned by Robert Vogel:
Ensure OutputPage::setFileVersion() is called in diff view

Reason:
Probably not relevant anymore.

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