Merge "Move MediaHandler defaults out of global scope"
[lhc/web/wiklou.git] / resources / src / mediawiki / mediawiki.Title.js
index c438d05..4c57faa 100644 (file)
                },
                // slash, colon (not supported by file systems like NTFS/Windows, Mac OS 9 [:], ext4 [/])
                {
-                       pattern: /[:\/#]/g,
+                       pattern: new RegExp( '[' + mw.config.get( 'wgIllegalFileChars', '' ) + ']', 'g' ),
                        replace: '-',
                        fileRule: true
                },
                                // 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\/]+)$/
                        ],
                getUrl: function ( params ) {
                        var fragment = this.getFragment();
                        if ( fragment ) {
-                               return mw.util.getUrl( this.toString() + '#' + this.getFragment(), params );
+                               return mw.util.getUrl( this.toString() + '#' + fragment, params );
                        } else {
                                return mw.util.getUrl( this.toString(), params );
                        }