jenkins-bot has submitted this change and it was merged.
Change subject: Validate language codes in CX API
......................................................................
Validate language codes in CX API
This does not check for allowed languages: that check is done in
the UI and not enforced here. This only disallows putting crap
into these fields.
Bug: T85686
Change-Id: Idf74d6fc45a04b52052081dca1b06921966ac557
---
M api/ApiContentTranslationPublish.php
1 file changed, 8 insertions(+), 0 deletions(-)
Approvals:
Santhosh: Looks good to me, approved
jenkins-bot: Verified
diff --git a/api/ApiContentTranslationPublish.php
b/api/ApiContentTranslationPublish.php
index 7fe5ede..9f927a0 100644
--- a/api/ApiContentTranslationPublish.php
+++ b/api/ApiContentTranslationPublish.php
@@ -102,6 +102,14 @@
$this->dieUsageMsg( 'blockedtext' );
}
+ if ( !Language::isKnownLanguageTag( $params['from'] ) ) {
+ $this->dieUsage( 'Invalid source language',
'invalidsourcelanguage' );
+ }
+
+ if ( !Language::isKnownLanguageTag( $params['to'] ) ) {
+ $this->dieUsage( 'Invalid target language',
'invalidtargetlanguage' );
+ }
+
if ( $params['status'] === 'draft' ) {
$this->saveAsDraft();
} else {
--
To view, visit https://gerrit.wikimedia.org/r/184579
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Idf74d6fc45a04b52052081dca1b06921966ac557
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/extensions/ContentTranslation
Gerrit-Branch: master
Gerrit-Owner: Nikerabbit <[email protected]>
Gerrit-Reviewer: Santhosh <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits