Skip to content

Commit c0a0747

Browse files
Applied PR feedback
1 parent d9d4292 commit c0a0747

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

API.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
use Piwik\API\Request;
1414
use Piwik\Common;
1515
use Piwik\DataTable;
16+
use Piwik\Http\BadRequestException;
1617
use Piwik\Metrics;
1718
use Piwik\Period\Range;
1819
use Piwik\Piwik;
@@ -53,11 +54,11 @@ public function getTreemapData(
5354
if (!Request::isCurrentApiRequestTheRootApiRequest()) {
5455
return [];
5556
}
56-
list($apiName, $apiAction) = explode('.', $apiMethod);
57+
list($module, $method) = explode('.', $apiMethod);
5758
$disAllowedApiActions = ['getBulkRequest'];
5859
// Block if API action does not start with get
59-
if (!in_array($apiAction, $disAllowedApiActions) || stripos($apiAction, 'get') !== 0) {
60-
throw new \Exception(Piwik::translate('TreemapVisualization_InvalidApiMethodException'));
60+
if (in_array($method, $disAllowedApiActions) || stripos($method, 'get') !== 0) {
61+
throw new BadRequestException(Piwik::translate('TreemapVisualization_InvalidApiMethodException'));
6162
}
6263

6364
if (

0 commit comments

Comments
 (0)