jenkins-bot has submitted this change and it was merged.
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(-)
Approvals:
Tim Starling: Looks good to me, approved
jenkins-bot: Verified
diff --git a/includes/upload/UploadBase.php b/includes/upload/UploadBase.php
index 183e7f3..17d8895 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: merged
Gerrit-Change-Id: Ibfcddc1a9c05fad4ac0b51a5a046d1ffaeb49db8
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Aaron Schulz <[email protected]>
Gerrit-Reviewer: Chad <[email protected]>
Gerrit-Reviewer: Parent5446 <[email protected]>
Gerrit-Reviewer: Tim Starling <[email protected]>
Gerrit-Reviewer: jenkins-bot
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits