Page MenuHomePhabricator

mediawiki.Title: Localised SVG thumbnails corrupt the newFromImg parser
Closed, ResolvedPublic

Description

3f5d41d4135740573f642 (bug 32987) introduced support for lang= on localised SVGs.

Thumbnails are generated in this form:

[[File:Gerrit_patchset_25838_test.svg|thumb|lang=de]]

https://upload.wikimedia.org/wikipedia/commons/thumb/4/45/Gerrit_patchset_25838_test.svg/langde-345px-Gerrit_patchset_25838_test.svg.png

mw.Title.newFromImg(Missing repository, expected "{src repository:path ...}" or "{src path repository=...}" in: {src:'https://upload.wikimedia.org/wikipedia/commons/thumb/4/45/Gerrit_patchset_25838_test.svg/langde-345px-Gerrit_patchset_25838_test.svg.png'});

File:Langde-345px-Gerrit patchset 25838 test.svg.png

Since both mw.Title.newFromImg and localised SVG thumbnails are introduced recently, this is a 1.22-alpha cycle regression that must be addressed before release.


Version: 1.22.0
Severity: critical

Details

Reference
bz55963

Event Timeline

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

So to be clear, mw.Title.newFromImg() tries to recover a title object from an image filename? This should just be a case of teaching it how to handle custom language SVGs?

(In reply to comment #1)

So to be clear, mw.Title.newFromImg() tries to recover a title object from an
image filename? This should just be a case of teaching it how to handle
custom
language SVGs?

Yes.

The bug here seems to be that these links are being done on the client side not the server side.

(In reply to comment #1)

So to be clear, mw.Title.newFromImg() tries to recover a title object from an
image filename? This should just be a case of teaching it how to handle
custom
language SVGs?

It should look at the directory name, not the actual filename. The format of the filename varries depending on which extensions are installed.additionally, Lonngish filenames even get shortened to things like 120px-thumbnail.jpg (change ext as appropriate). This is nothing new...

Change 90897 had a related patch set uploaded by Jarry1250:
Generalise filename-matching in mediawiki.Title.newFromImg()

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

It should look at the directory name, not the actual filename. The format of
the filename varries depending on which extensions are
installed.additionally,
Lonngish filenames even get shortened to things like 120px-thumbnail.jpg
(change ext as appropriate). This is nothing new...

Specific example: https://upload.wikimedia.org/wikipedia/commons/thumb/a/a0/Geschw._Lenders%2C_Hoflieferanten%2C_Leinen-_und_W%C3%A4sche-Ausstattungsmagazin%2C_Modewaaren%2C_Allee-_und_Elberfelderstr.-Ecke_24_%28Adressbuch_der_Oberb%C3%BCrgermeisterei_D%C3%BCsseldorf_f%C3%BCr_das_Jahr_1890%2C_Erster_Theil._S._179%29.jpg/120px-thumbnail.jpg

(We do this for any file where the thumbnail is > 160 bytes)

Also I'm somewhat doubtful that [^\s\\] actually corresponds to allowed characters (U+1680 for example is allowed in files I believe).

Change 90897 merged by jenkins-bot:
mediawiki.Title: Generalise filename-matching in newFromImg

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