Skip to content

Commit be70d88

Browse files
committed
Avoid double URL encoding for params
According to documentation, for filters, URL-reserved characters — Characters such as & must be url-encoded in the usual way, see https://developers.google.com/analytics/devguides/reporting/core/v3/reference#filterExpressions If in a filter such as ga:pagePath an URI is used, which needs to be url-encoded, the createRequestUri method will apply an additional rawurlencode() on it resulting in a double URL encoding.
1 parent f0e6421 commit be70d88

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/Google/Http/REST.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,10 +153,10 @@ public static function createRequestUri($servicePath, $restPath, $params)
153153
} else if ($paramSpec['location'] == 'query') {
154154
if (isset($paramSpec['repeated']) && is_array($paramSpec['value'])) {
155155
foreach ($paramSpec['value'] as $value) {
156-
$queryVars[] = $paramName . '=' . rawurlencode($value);
156+
$queryVars[] = $paramName . '=' . rawurlencode(rawurldecode($value));
157157
}
158158
} else {
159-
$queryVars[] = $paramName . '=' . rawurlencode($paramSpec['value']);
159+
$queryVars[] = $paramName . '=' . rawurlencode(rawurldecode($paramSpec['value']));
160160
}
161161
}
162162
}

0 commit comments

Comments
 (0)