Hoo man has uploaded a new change for review. https://gerrit.wikimedia.org/r/133160
Change subject: Catch EntityIdParsingExceptions in wbgetclaims ...................................................................... Catch EntityIdParsingExceptions in wbgetclaims Bug: 65095 Change-Id: I7cc5e7e122f0b9504f77ce9a05a23b033c5cf542 --- M repo/includes/api/GetClaims.php 1 file changed, 13 insertions(+), 2 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase refs/changes/60/133160/1 diff --git a/repo/includes/api/GetClaims.php b/repo/includes/api/GetClaims.php index c2b6d2a..f350761 100644 --- a/repo/includes/api/GetClaims.php +++ b/repo/includes/api/GetClaims.php @@ -4,6 +4,7 @@ use ApiBase; use ApiMain; +use Wikibase\DataModel\Entity\EntityIdParsingException; use Wikibase\DataModel\Claim\Claim; use Wikibase\DataModel\Claim\ClaimGuidParser; use Wikibase\DataModel\Claim\Claims; @@ -63,7 +64,12 @@ list( $id, $claimGuid ) = $this->getIdentifiers( $params ); - $entityId = $this->idParser->parse( $id ); + try { + $entityId = $this->idParser->parse( $id ); + } catch ( EntityIdParsingException $e ) { + $this->dieException( $e, 'param-invalid' ); + } + $entityRevision = $entityId ? $this->loadEntityRevision( $entityId ) : null; $entity = $entityRevision->getEntity(); @@ -151,7 +157,12 @@ $params = $this->extractRequestParams(); if ( isset( $params['property'] ) ){ - $parsedProperty = $this->idParser->parse( $params['property'] ); + try { + $parsedProperty = $this->idParser->parse( $params['property'] ); + } catch ( EntityIdParsingException $e ) { + $this->dieException( $e, 'param-invalid' ); + } + $matchFilter = $propertyId->equals( $parsedProperty ); return $matchFilter; } -- To view, visit https://gerrit.wikimedia.org/r/133160 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I7cc5e7e122f0b9504f77ce9a05a23b033c5cf542 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/Wikibase Gerrit-Branch: master Gerrit-Owner: Hoo man <h...@online.de> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits