[FileRepo] Throw an exception if a storage key is invalid.
authorAaron <aschulz@wikimedia.org>
Thu, 20 Sep 2012 20:47:15 +0000 (13:47 -0700)
committerAaron <aschulz@wikimedia.org>
Thu, 20 Sep 2012 20:47:15 +0000 (13:47 -0700)
Change-Id: Ie479d940dddcf7a9eca5d68a76fbe3fa70a6d4d7

includes/filerepo/FileRepo.php

index a31b148..5f24fed 100644 (file)
@@ -1321,6 +1321,9 @@ class FileRepo {
         * @return string
         */
        public function getDeletedHashPath( $key ) {
+               if ( strlen( $key ) < 31 ) {
+                       throw new MWException( "Invalid storage key '$key'." );
+               }
                $path = '';
                for ( $i = 0; $i < $this->deletedHashLevels; $i++ ) {
                        $path .= $key[$i] . '/';