Merge "Add option to expose original sha1 in thumb url"
[lhc/web/wiklou.git] / includes / filerepo / file / File.php
index ec5af85..cde5e6a 100644 (file)
@@ -946,9 +946,16 @@ abstract class File implements IDBAccessObject {
                $extension = $this->getExtension();
                list( $thumbExt, ) = $this->getHandler()->getThumbType(
                        $extension, $this->getMimeType(), $params );
-               $thumbName = $this->getHandler()->makeParamString( $params ) . '-' . $name;
-               if ( $thumbExt != $extension ) {
-                       $thumbName .= ".$thumbExt";
+               $thumbName = $this->getHandler()->makeParamString( $params );
+
+               if ( $this->repo->supportsSha1URLs() ) {
+                       $thumbName .= '-' . $this->getSha1() . '.' . $thumbExt;
+               } else {
+                       $thumbName .= '-' . $name;
+
+                       if ( $thumbExt != $extension ) {
+                               $thumbName .= ".$thumbExt";
+                       }
                }
 
                return $thumbName;