Merge "Replace Pakaran with Punjabi"
[lhc/web/wiklou.git] / includes / api / ApiUpload.php
index 34741b5..6f6b080 100644 (file)
@@ -410,6 +410,10 @@ class ApiUpload extends ApiBase {
                                $this->dieUsageMsg( 'copyuploadbaddomain' );
                        }
 
+                       if ( !UploadFromUrl::isAllowedUrl( $this->mParams['url'] ) ) {
+                               $this->dieUsageMsg( 'copyuploadbadurl' );
+                       }
+
                        $async = false;
                        if ( $this->mParams['asyncdownload'] ) {
                                $this->checkAsyncDownloadEnabled();
@@ -561,7 +565,8 @@ class ApiUpload extends ApiBase {
                        if ( isset( $warnings['exists'] ) ) {
                                $warning = $warnings['exists'];
                                unset( $warnings['exists'] );
-                               $warnings[$warning['warning']] = $warning['file']->getName();
+                               $localFile = isset( $warning['normalizedFile'] ) ? $warning['normalizedFile'] : $warning['file'];
+                               $warnings[$warning['warning']] = $localFile->getName();
                        }
                }
                return $warnings;