From 9ccad8e8b3c85e991de6801922a3e86030bcf3f2 Mon Sep 17 00:00:00 2001 From: Brian Wolff Date: Tue, 16 Aug 2011 05:37:18 +0000 Subject: [PATCH] follow-up r88171 - fix fatal if suggested filename has illegal character in it. Check to make sure the title object actual exists, before checking its namespace, since alll the does this have illegal chars check is done after the does it start with file: check. For future note though, when using upload by url feature, the suggested destination name when you put http://upload.wikimedia.org/wikipedia/commons/e/e0/Petrorhagia_prolifera_%281%29.JPG is illegal, which is probably not very user-friendly (filed as bug 30390) --- includes/upload/UploadBase.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/upload/UploadBase.php b/includes/upload/UploadBase.php index 78f5d66045..429a363bbd 100644 --- a/includes/upload/UploadBase.php +++ b/includes/upload/UploadBase.php @@ -611,7 +611,7 @@ abstract class UploadBase { * and that the namespace prefix needs to be stripped of. */ $title = Title::newFromText( $this->mDesiredDestName ); - if ( $title->getNamespace() == NS_FILE ) { + if ( $title && $title->getNamespace() == NS_FILE ) { $this->mFilteredName = $title->getDBkey(); } else { $this->mFilteredName = $this->mDesiredDestName; -- 2.20.1