Alex Monk has uploaded a new change for review.

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

Change subject: Avoid passing anything but a string to Title::newFromText in 
UploadBase::getTitle
......................................................................

Avoid passing anything but a string to Title::newFromText in 
UploadBase::getTitle

Bug: T109974
Change-Id: I54d42bcdcb95cb5b6a09c1c3bdea8891a14a7fdb
---
M includes/upload/UploadBase.php
1 file changed, 6 insertions(+), 5 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/09/233209/1

diff --git a/includes/upload/UploadBase.php b/includes/upload/UploadBase.php
index 493df2e..e31c774 100644
--- a/includes/upload/UploadBase.php
+++ b/includes/upload/UploadBase.php
@@ -752,14 +752,15 @@
                if ( $this->mTitle !== false ) {
                        return $this->mTitle;
                }
+               $this->mFilteredName = $this->mDesiredDestName;
                /* Assume that if a user specified File:Something.jpg, this is 
an error
                 * and that the namespace prefix needs to be stripped of.
                 */
-               $title = Title::newFromText( $this->mDesiredDestName );
-               if ( $title && $title->getNamespace() == NS_FILE ) {
-                       $this->mFilteredName = $title->getDBkey();
-               } else {
-                       $this->mFilteredName = $this->mDesiredDestName;
+               if ( is_string( $this->mDesiredDestName ) ) {
+                       $title = Title::newFromText( $this->mDesiredDestName );
+                       if ( $title && $title->getNamespace() == NS_FILE ) {
+                               $this->mFilteredName = $title->getDBkey();
+                       }
                }
 
                # oi_archive_name is max 255 bytes, which include a timestamp 
and an

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I54d42bcdcb95cb5b6a09c1c3bdea8891a14a7fdb
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Alex Monk <[email protected]>

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

Reply via email to