jenkins-bot has submitted this change and it was merged. (
https://gerrit.wikimedia.org/r/362254 )
Change subject: Switch all forms to POST
......................................................................
Switch all forms to POST
Bug: T169251
Change-Id: Icbe6724e155a608b6122ad1b421251c0958aeb64
---
M src/Html/ChangeTitleForm.php
M src/Html/ImportPreviewPage.php
M src/Html/InputFormPage.php
M src/SpecialImportFile.php
M tests/phpunit/SpecialImportFileIntegrationTest.php
5 files changed, 28 insertions(+), 21 deletions(-)
Approvals:
WMDE-Fisch: Looks good to me, approved
jenkins-bot: Verified
diff --git a/src/Html/ChangeTitleForm.php b/src/Html/ChangeTitleForm.php
index 46efcb4..88dffcc 100644
--- a/src/Html/ChangeTitleForm.php
+++ b/src/Html/ChangeTitleForm.php
@@ -31,7 +31,7 @@
'form',
[
'action' =>
$this->specialPage->getPageTitle()->getLocalURL(),
- 'method' => 'GET',
+ 'method' => 'POST',
]
) .
Html::element(
diff --git a/src/Html/ImportPreviewPage.php b/src/Html/ImportPreviewPage.php
index 9fd0d6f..b7a6a67 100644
--- a/src/Html/ImportPreviewPage.php
+++ b/src/Html/ImportPreviewPage.php
@@ -68,7 +68,7 @@
[
'class' => 'mw-importfile-rightAlign',
'action' =>
$this->specialPage->getPageTitle()->getLocalURL(),
- 'method' => 'GET',
+ 'method' => 'POST',
]
) .
Html::element(
@@ -103,7 +103,7 @@
[
'class' => 'mw-importfile-rightAlign',
'action' =>
$this->specialPage->getPageTitle()->getLocalURL(),
- 'method' => 'GET',
+ 'method' => 'POST',
]
) .
Html::element(
@@ -173,6 +173,14 @@
'value' =>
$this->specialPage->getUser()->getEditToken()
]
) .
+ Html::element(
+ 'input',
+ [
+ 'type' => 'hidden',
+ 'name' => 'action',
+ 'value' => 'submit',
+ ]
+ ) .
new ButtonInputWidget(
[
'classes' => [ 'mw-importfile-import-submit' ],
diff --git a/src/Html/InputFormPage.php b/src/Html/InputFormPage.php
index 2ab87a1..d361571 100644
--- a/src/Html/InputFormPage.php
+++ b/src/Html/InputFormPage.php
@@ -46,7 +46,7 @@
'form',
[
'action' =>
$this->specialPage->getPageTitle()->getLocalURL(),
- 'method' => 'GET',
+ 'method' => 'POST',
]
) .
new TextInputWidget(
diff --git a/src/SpecialImportFile.php b/src/SpecialImportFile.php
index 74e26e0..cf85d79 100644
--- a/src/SpecialImportFile.php
+++ b/src/SpecialImportFile.php
@@ -22,7 +22,6 @@
use FileImporter\Services\SourceSiteLocator;
use Html;
use ILocalizedException;
-use InvalidArgumentException;
use MediaWiki\MediaWikiServices;
use Message;
use PermissionsError;
@@ -122,22 +121,21 @@
return;
}
- if ( $this->getRequest()->wasPosted() ) {
- if ( !$this->doImport( $importPlan ) ) {
- $this->showImportPage( $importPlan );
- }
- } else {
- switch ( $this->getRequest()->getVal( 'action' ) ) {
- case 'edittitle':
- $out->addHTML(
- ( new ChangeTitleForm( $this,
$importPlan ) )->getHtml()
- );
- break;
- case 'editinfo':
- // TODO implement
- default:
+ switch ( $this->getRequest()->getVal( 'action' ) ) {
+ case 'submit':
+ if ( !$this->doImport( $importPlan ) ) {
$this->showImportPage( $importPlan );
- }
+ }
+ break;
+ case 'edittitle':
+ $out->addHTML(
+ ( new ChangeTitleForm( $this,
$importPlan ) )->getHtml()
+ );
+ break;
+ case 'editinfo':
+ // TODO implement
+ default:
+ $this->showImportPage( $importPlan );
}
}
diff --git a/tests/phpunit/SpecialImportFileIntegrationTest.php
b/tests/phpunit/SpecialImportFileIntegrationTest.php
index dbd3d2e..f8de4d3 100644
--- a/tests/phpunit/SpecialImportFileIntegrationTest.php
+++ b/tests/phpunit/SpecialImportFileIntegrationTest.php
@@ -194,7 +194,7 @@
is( htmlPiece( havingChild(
both( withTagName( 'form' ) )
->andAlso(
withAttribute( 'action' ) )
- ->andAlso(
withAttribute( 'method' )->havingValue( 'GET' ) )
+ ->andAlso(
withAttribute( 'method' )->havingValue( 'POST' ) )
->andAlso( havingChild(
both(
withTagName( 'input' ) )
->andAlso( withAttribute( 'type' )->havingValue( 'url' ) )
@@ -235,6 +235,7 @@
)
->andAlso( havingChild(
$this->thatIsHiddenInputFieldWithSomeValue( 'importDetailsHash' ) ) )
->andAlso( havingChild(
$this->thatIsHiddenInputFieldWithSomeValue( 'token' ) ) )
+ ->andAlso( havingChild(
$this->thatIsHiddenInputField( 'action', 'submit' ) ) )
->andAlso( havingChild(
both( withTagName( 'button' ) )
->andAlso(
withAttribute( 'type' )->havingValue( 'submit' ) )
--
To view, visit https://gerrit.wikimedia.org/r/362254
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Icbe6724e155a608b6122ad1b421251c0958aeb64
Gerrit-PatchSet: 6
Gerrit-Project: mediawiki/extensions/FileImporter
Gerrit-Branch: master
Gerrit-Owner: Addshore <[email protected]>
Gerrit-Reviewer: Andrew-WMDE <[email protected]>
Gerrit-Reviewer: MarkTraceur <[email protected]>
Gerrit-Reviewer: Tobias Gritschacher <[email protected]>
Gerrit-Reviewer: WMDE-Fisch <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits