Fix false edit in "Edit File Info" from enabling the edit summary
Closed, ResolvedPublic

Description

When a user opens the "Edit File Info", doesn't make any changes, and hits submit the "Edit Summary" input field on the import preview page will become enabled even though it should remain disabled until the user actually makes a change.

This is appears to be due to the fact that when the Wikitext editor is called the data returned on a submit can contain different hidden characters (e.g. \n becomes \r\n). The check currently implemented in T160184 rightly indicates that the too strings are different, however, Mediawiki seems to ignore these changes, therefore, no revision is created and the now enabled edit summary is ignored.

A solution may be to implement the same check that Mediawiki uses to determine whether or not the submitted Wikitext is different and if so only then allow editing the summary. That way an edit summary can only be added if Mediawiki were to create a revision.

Restricted Application added a subscriber: Aklapper. · View Herald TranscriptSep 15 2017, 6:14 PM
Andrew-WMDE renamed this task from Fix to Fix false edit in "Edit File Info" from enabling the edit summary.Sep 15 2017, 6:16 PM

@Andrew-WMDE think your answer is here:

https://github.com/wikimedia/mediawiki/blob/master/includes/EditPage.php#L862-L865

https://github.com/wikimedia/mediawiki/blob/master/includes/EditPage.php#L4499

We can probably just do the same rtrim in our code.
We could try to make our page extend / become an EditPage but that seems quite involved.

Addshore moved this task from Backlog to Watching on the User-Addshore board.Sep 18 2017, 11:55 PM
WMDE-Fisch moved this task from Sprint Backlog to Doing on the WMDE-QWERTY-Sprint-2017-09-19 board.

Change 379511 had a related patch set uploaded (by WMDE-Fisch; owner: WMDE-Fisch):
[mediawiki/extensions/FileImporter@master] Remove trailing whitspaces on FileInfoText input

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

Change 379511 merged by jenkins-bot:
[mediawiki/extensions/FileImporter@master] Remove trailing whitspaces on FileInfoText input

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

Tobi_WMDE_SW closed this task as Resolved.Tue, Oct 10, 9:27 AM