From: Brian Wolff Date: Tue, 16 Aug 2011 05:37:18 +0000 (+0000) Subject: follow-up r88171 - fix fatal if suggested filename has illegal character in it. X-Git-Tag: 1.31.0-rc.0~28241 X-Git-Url: https://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/banques/ajouter.php?a=commitdiff_plain;h=9ccad8e8b3c85e991de6801922a3e86030bcf3f2;p=lhc%2Fweb%2Fwiklou.git 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) --- 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;