jenkins-bot has submitted this change and it was merged.

Change subject: Handle TemplateParser::parsePage() returning an empty array
......................................................................


Handle TemplateParser::parsePage() returning an empty array

Bug: 73107
Change-Id: I0361a6bd8f6103559a5cfc91fb99b706a39223df
---
M DataCollector.php
1 file changed, 5 insertions(+), 1 deletion(-)

Approvals:
  Gilles: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/DataCollector.php b/DataCollector.php
index 018954b..1e8042f 100644
--- a/DataCollector.php
+++ b/DataCollector.php
@@ -109,8 +109,12 @@
         *  - no-source - failed to detect the source of the image or a custom 
attribution text
         */
        public function verifyAttributionMetadata( $descriptionText ) {
-               $problems = array();
                $templateData = $this->templateParser->parsePage( 
$descriptionText );
+               if ( !$templateData ) {
+                       return array( 'no-license', 'no-description', 
'no-author', 'no-source' );
+               }
+
+               $problems = array();
                $licenseData = $this->selectLicense( 
$templateData[TemplateParser::LICENSES_KEY] );
                $informationData = $this->selectInformationTemplate( 
$templateData[TemplateParser::INFORMATION_FIELDS_KEY] );
 

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I0361a6bd8f6103559a5cfc91fb99b706a39223df
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/extensions/CommonsMetadata
Gerrit-Branch: master
Gerrit-Owner: Reedy <[email protected]>
Gerrit-Reviewer: GergÅ‘ Tisza <[email protected]>
Gerrit-Reviewer: Gilles <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

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

Reply via email to