mw.Title: Correct order of file URL regexes in newFromImg
authorBartosz Dziewoński <matma.rex@gmail.com>
Tue, 31 May 2016 22:40:15 +0000 (00:40 +0200)
committerBartosz Dziewoński <matma.rex@gmail.com>
Tue, 31 May 2016 22:40:15 +0000 (00:40 +0200)
The "Thumbnails in non-hashed upload directories" regex can match
non-thumbnailed files in hashed directories if the file name contains
the word "thumbnail" or the first two bytes of the MD5 hash of the
file name. We should check "Full size images" first.

Bug: T134860
Change-Id: I74af47969bf9ba204c24e299f788f5349302e437

resources/src/mediawiki/mediawiki.Title.js

index 6859592..ff4d1c2 100644 (file)
                                // Thumbnails
                                /\/[a-f0-9]\/[a-f0-9]{2}\/([^\s\/]+)\/[^\s\/]+-[^\s\/]*$/,
 
-                               // Thumbnails in non-hashed upload directories
-                               /\/([^\s\/]+)\/[^\s\/]+-(?:\1|thumbnail)[^\s\/]*$/,
-
                                // Full size images
                                /\/[a-f0-9]\/[a-f0-9]{2}\/([^\s\/]+)$/,
 
+                               // Thumbnails in non-hashed upload directories
+                               /\/([^\s\/]+)\/[^\s\/]+-(?:\1|thumbnail)[^\s\/]*$/,
+
                                // Full-size images in non-hashed upload directories
                                /\/([^\s\/]+)$/
                        ],