Santhosh has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/394915 )
Change subject: ApiULSLocalization: Correct the language code validation ...................................................................... ApiULSLocalization: Correct the language code validation Use Language::isKnownLanguageTag instead of Language::isValidCode isValidCode will accept strings that are not language code like abcd. Also removed the check for dieWithError method Change-Id: I511dfab03208b3fd70079cb97ad70549935cc6cb --- M api/ApiULSLocalization.php 1 file changed, 2 insertions(+), 6 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/UniversalLanguageSelector refs/changes/15/394915/1 diff --git a/api/ApiULSLocalization.php b/api/ApiULSLocalization.php index c86b5db..6176c3b 100644 --- a/api/ApiULSLocalization.php +++ b/api/ApiULSLocalization.php @@ -29,12 +29,8 @@ $params = $this->extractRequestParams(); $language = $params['language']; - if ( !Language::isValidCode( $language ) ) { - if ( is_callable( [ $this, 'dieWithError' ] ) ) { - $this->dieWithError( [ 'apierror-invalidlang', 'language' ], 'invalidlanguage' ); - } else { - $this->dieUsage( 'Invalid language', 'invalidlanguage' ); - } + if ( !Language::isKnownLanguageTag( $language ) ) { + $this->dieWithError( [ 'apierror-invalidlang', 'language' ], 'invalidlanguage' ); } $contents = ULSJsonMessageLoader::getMessages( $language ); // Output the file's contents raw -- To view, visit https://gerrit.wikimedia.org/r/394915 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I511dfab03208b3fd70079cb97ad70549935cc6cb Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/UniversalLanguageSelector Gerrit-Branch: master Gerrit-Owner: Santhosh <santhosh.thottin...@gmail.com> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits