Aaron Schulz has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/96640


Change subject: Fixed fatal error when getLocalCopy() fails
......................................................................

Fixed fatal error when getLocalCopy() fails

bug: 40166
Change-Id: Ibfcddc1a9c05fad4ac0b51a5a046d1ffaeb49db8
---
M includes/upload/UploadBase.php
1 file changed, 8 insertions(+), 5 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/40/96640/1

diff --git a/includes/upload/UploadBase.php b/includes/upload/UploadBase.php
index b162de2..447af53 100644
--- a/includes/upload/UploadBase.php
+++ b/includes/upload/UploadBase.php
@@ -250,7 +250,7 @@
 
        /**
         * @param string $srcPath the source path
-        * @return string the real path if it was a virtual URL
+        * @return string|bool the real path if it was a virtual URL Returns 
false on failure
         */
        function getRealPath( $srcPath ) {
                wfProfileIn( __METHOD__ );
@@ -259,12 +259,15 @@
                        // @todo just make uploads work with storage paths
                        // UploadFromStash loads files via virtual URLs
                        $tmpFile = $repo->getLocalCopy( $srcPath );
-                       $tmpFile->bind( $this ); // keep alive with $this
-                       wfProfileOut( __METHOD__ );
-                       return $tmpFile->getPath();
+                       if ( $tmpFile ) {
+                               $tmpFile->bind( $this ); // keep alive with 
$this
+                       }
+                       $path = $tmpFile ? $tmpFile->getPath() : false;
+               } else {
+                       $path = $srcPath;
                }
                wfProfileOut( __METHOD__ );
-               return $srcPath;
+               return $path;
        }
 
        /**

-- 
To view, visit https://gerrit.wikimedia.org/r/96640
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ibfcddc1a9c05fad4ac0b51a5a046d1ffaeb49db8
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Aaron Schulz <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to