Page MenuHomePhabricator

Linter does not detect invalid "500px500px" as a bogus file option
Closed, ResolvedPublic

Description

See https://en.wikipedia.org/w/index.php?title=User:Jonesey95/sandbox3&oldid=883099293

I came across this invalid sizing option in the wild: (number)px(number)px. Valid options are:

*(number)x(number)px
*(number)px
*x(number)px

The file specification in question has an unnamed caption parameter, which is interpreted correctly, so it looks like the "px" parameter is being read as a sizing parameter, but it is invalid and is not processed. If I change it to "500p", it is correctly flagged by Linter as extra text.

"500px500px" should be flagged as a Bogus file option by Linter.

Event Timeline

See also the second example here:

https://en.wikipedia.org/w/index.php?title=User:Jonesey95/sandbox3&oldid=883109306

It contains "600 px" as a setting. It is similarly invalid, not processed, and not marked as bogus.

(Edited to add: I have updated Help:Images on the MediaWiki site to document this behavior. If it is a feature, then you can ignore this second example, since it is documented now. If it's a bug, let me know here, and I'll correct the documentation. Thanks.)

Possibly related: "left150px" is not recognized as a bogus option.

[File:Israeli Ballot Divider.JPG|thumb|left150px|Israeli poll booth]

It does not resize to 150px, it does not place the image on the left, and it does not show a Linter error. At least one of those behaviors appears to be a bug.

ssastry moved this task from Backlog to Parsoid on the MediaWiki-extensions-Linter board.

Another flavor that is not detected as a Linter error (extra "300px" parameter):

[[File:Standard of Macdonald of Clanranald.svg|thumb|300px|300px|[[Heraldic standard]] of the current clan chief.]]

Similar:

[[File:Michna Ceska maryanska muzyka.jpg|250px|right|thumb|x216px|Caption]]

Change 661820 had a related patch set uploaded (by Sbailey; owner: Sbailey):
[mediawiki/services/parsoid@master] WIP Catch invalid image link parameters

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

Change 665226 had a related patch set uploaded (by Arlolra; owner: Sbailey):
[mediawiki/services/parsoid@master] Lint duplicated media width options

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

Change 661820 merged by jenkins-bot:
[mediawiki/services/parsoid@master] Lint bogus media width options

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

Change 665226 merged by jenkins-bot:
[mediawiki/services/parsoid@master] Lint duplicated media width options

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

Fixed by patches:

https://gerrit.wikimedia.org/r/c/mediawiki/services/parsoid/+/661820

which addresses bogus width options, and

https://gerrit.wikimedia.org/r/c/mediawiki/services/parsoid/+/665226

which addresses duplicate width options.

Change 666213 had a related patch set uploaded (by C. Scott Ananian; owner: C. Scott Ananian):
[mediawiki/vendor@master] Bump wikimedia/parsoid to 0.13.0-a25

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

Change 666213 merged by jenkins-bot:
[mediawiki/vendor@master] Bump wikimedia/parsoid to 0.13.0-a25

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