Dan-nl has uploaded a new change for review.

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


Change subject: max-file-size
......................................................................

max-file-size

chris steipp requested that:

* we remove MAX_FILE_SIZE since we shouldn’t rely on it, are not using it,
  and don’t want to accidentally suggest to another developer that we
  are using it.

* we not urldecode in getUserOptions() after filtering the $_POSTed data,
  since it invalidates any urlencoding we may have done.

Change-Id: Ib97995ea991c6766f63c4da49d960f146a53b396
---
M GWToolset.i18n.php
M includes/Forms/MetadataDetectForm.php
M includes/Handlers/Forms/MetadataDetectHandler.php
M includes/Handlers/Forms/MetadataMappingHandler.php
M includes/Helpers/FileChecks.php
5 files changed, 5 insertions(+), 21 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/GWToolset 
refs/changes/65/97465/1

diff --git a/GWToolset.i18n.php b/GWToolset.i18n.php
index df2cecc..11ce1b0 100644
--- a/GWToolset.i18n.php
+++ b/GWToolset.i18n.php
@@ -78,7 +78,6 @@
        'gwtoolset-mime-type-mismatch' => 'The uploaded file’s extension ($1) 
and mime-type ($2) do not match.',
        'gwtoolset-missing-temp-folder' => 'Missing a temporary folder.',
        'gwtoolset-no-file' => 'No file received.',
-       'gwtoolset-over-max-file-size' => 'The uploaded file exceeds the 
<code>MAX_FILE_SIZE</code> directive that was specified in the HTML form.',
        'gwtoolset-over-max-ini' => 'The uploaded file exceeds the 
<code>upload_max_filesize</code> and/or the <code>post_max_size</code> 
directive in php.ini.',
        'gwtoolset-partial-upload' => 'The uploaded file was only partially 
uploaded.',
        'gwtoolset-php-extension-error' => 'A PHP extension stopped the file 
upload. PHP does not provide a way to ascertain which extension caused the file 
upload to stop; examining the list of loaded extensions with phpinfo() may 
help.',
@@ -382,7 +381,6 @@
        'gwtoolset-no-xml-source' => 'Hint to the developer that appears when 
no local XML source was given',
        'gwtoolset-not-string' => 'Developer message that appears when the 
value provided to the method was not a string; parameter $1 is the actual type 
of the value.',
        'gwtoolset-over-max-ini' => 'User error message that appears when the 
uploaded file exceeds the upload_max_filesize directive in php.ini.',
-       'gwtoolset-over-max-file-size' => 'User error message that appears when 
the uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the 
HTML form.',
        'gwtoolset-page-title-contains-url' => 'Appears when the page title 
being requested contains the URL of the site and not just the page title',
        'gwtoolset-painted-by' => 'Placeholder text for category phrasing in 
Step 2 in the HTML form.',
        'gwtoolset-partial-upload' => 'User error message that appears when the 
uploaded file was only partially uploaded.',
diff --git a/includes/Forms/MetadataDetectForm.php 
b/includes/Forms/MetadataDetectForm.php
index 22a0b62..1e2d951 100644
--- a/includes/Forms/MetadataDetectForm.php
+++ b/includes/Forms/MetadataDetectForm.php
@@ -115,15 +115,6 @@
                                )
                        ) .
 
-                       Html::rawElement(
-                               'input',
-                               array(
-                                       'type' => 'hidden',
-                                       'name' => 'MAX_FILE_SIZE',
-                                       'value' => 
FileChecks::getMaxUploadSize()
-                               )
-                       ) .
-
                        Html::openElement( 'ol' ) .
 
                        Html::rawElement(
diff --git a/includes/Handlers/Forms/MetadataDetectHandler.php 
b/includes/Handlers/Forms/MetadataDetectHandler.php
index 5aeeb1d..91b8762 100644
--- a/includes/Handlers/Forms/MetadataDetectHandler.php
+++ b/includes/Handlers/Forms/MetadataDetectHandler.php
@@ -30,7 +30,6 @@
         */
        protected $_expected_post_fields = array(
                'gwtoolset-form' => array( 'size' => 255 ),
-               'MAX_FILE_SIZE' => array( 'size' => 255 ),
                'gwtoolset-mediawiki-template-name' => array( 'size' => 255 ),
                'gwtoolset-metadata-file-upload' => array( 'size' => 255 ),
                'gwtoolset-metadata-mapping-url' => array( 'size' => 255 ),
@@ -118,11 +117,11 @@
                                : null,
 
                        'gwtoolset-metadata-file-url' => !empty( 
$this->_whitelisted_post['gwtoolset-metadata-file-url'] )
-                               ? urldecode( 
$this->_whitelisted_post['gwtoolset-metadata-file-url'] )
+                               ? 
$this->_whitelisted_post['gwtoolset-metadata-file-url']
                                : null,
 
                        'gwtoolset-metadata-mapping-url' => !empty( 
$this->_whitelisted_post['gwtoolset-metadata-mapping-url'] )
-                               ? urldecode( 
$this->_whitelisted_post['gwtoolset-metadata-mapping-url'] )
+                               ? 
$this->_whitelisted_post['gwtoolset-metadata-mapping-url']
                                : null,
 
                        'Metadata-Title' => null,
diff --git a/includes/Handlers/Forms/MetadataMappingHandler.php 
b/includes/Handlers/Forms/MetadataMappingHandler.php
index e05aab2..793b6f5 100644
--- a/includes/Handlers/Forms/MetadataMappingHandler.php
+++ b/includes/Handlers/Forms/MetadataMappingHandler.php
@@ -191,12 +191,12 @@
 
                        'gwtoolset-metadata-file-url' =>
                                !empty( 
$this->_whitelisted_post['gwtoolset-metadata-file-url'] )
-                               ? urldecode( 
$this->_whitelisted_post['gwtoolset-metadata-file-url'] )
+                               ? 
$this->_whitelisted_post['gwtoolset-metadata-file-url']
                                : null,
 
                        'gwtoolset-metadata-file-mwstore' =>
                                !empty( 
$this->_whitelisted_post['gwtoolset-metadata-file-mwstore'] )
-                               ? urldecode( 
$this->_whitelisted_post['gwtoolset-metadata-file-mwstore'] )
+                               ? 
$this->_whitelisted_post['gwtoolset-metadata-file-mwstore']
                                : null,
 
                        'gwtoolset-metadata-file-sha1' =>
@@ -206,7 +206,7 @@
 
                        'gwtoolset-partner-template-url' =>
                                !empty( 
$this->_whitelisted_post['gwtoolset-partner-template-url'] )
-                               ? urldecode( 
$this->_whitelisted_post['gwtoolset-partner-template-url'] )
+                               ? 
$this->_whitelisted_post['gwtoolset-partner-template-url']
                                : null,
 
                        'preview' => !empty( 
$this->_whitelisted_post['gwtoolset-preview'] )
diff --git a/includes/Helpers/FileChecks.php b/includes/Helpers/FileChecks.php
index f897852..76a66e5 100644
--- a/includes/Helpers/FileChecks.php
+++ b/includes/Helpers/FileChecks.php
@@ -295,10 +295,6 @@
                                $msg = 'gwtoolset-over-max-ini';
                                break;
 
-                       case UPLOAD_ERR_FORM_SIZE :
-                               $msg = 'gwtoolset-over-max-file-size';
-                               break;
-
                        case UPLOAD_ERR_PARTIAL :
                                $msg = 'gwtoolset-partial-upload';
                                break;

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ib97995ea991c6766f63c4da49d960f146a53b396
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/GWToolset
Gerrit-Branch: master
Gerrit-Owner: Dan-nl <[email protected]>

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

Reply via email to