Follow up with the problem noted in r90530.
[lhc/web/wiklou.git] / includes / upload / UploadStash.php
index 2412643..8432f0d 100644 (file)
@@ -14,7 +14,7 @@
 class UploadStash {
 
        // Format of the key for files -- has to be suitable as a filename itself (e.g. ab12cd34ef.jpg)
-       const KEY_FORMAT_REGEX = '/^[\w-]+\.\w+$/';
+       const KEY_FORMAT_REGEX = '/^[\w-]+\.\w*$/';
 
        /**
         * repository that this uses to store temp files
@@ -140,9 +140,11 @@ class UploadStash {
                        // This is a bit lame, as we may have more info in the $status and we're throwing it away, but to fix it means
                        // redesigning API errors significantly.
                        // $status->value just contains the virtual URL (if anything) which is probably useless to the caller
-                       $error = reset( $status->getErrorsArray() );
+                       $error = $status->getErrorsArray();
+                       $error = reset( $error );
                        if ( ! count( $error ) ) {
-                               $error = reset( $status->getWarningsArray() );
+                               $error = $status->getWarningsArray();
+                               $error = reset( $error );
                                if ( ! count( $error ) ) {
                                        $error = array( 'unknown', 'no error recorded' );
                                }