Skip to content

Fix Piwik API to be used with AngularJS JSONP callback #4560

@anonymous-matomo-user

Description

@anonymous-matomo-user

Hello everyone,

Piwik API is not compatible with $http.jsonp in AngularJS.

Docs: http://docs.angularjs.org/api/ng.$http

An API call like :

`````` jsoncallback=JSON_CALLBACK```

will be transform by AngularJS as something like:

jsoncallback=angular.callbacks._0

But the Piwik API doesn't allow '.' in the jsoncallback parameter.

To fix this bug, you just have to change:


/core/DataTable/Renderer/Json.php``` (line 111)

```
#!php
if (preg_match('/^[0-9a-zA-Z_]*$/D', $jsonCallback) > 0) {
```

By:

```
#!php
if (preg_match('/^[0-9a-zA-Z_.]*$/D', $jsonCallback) > 0) {
```

It would be great :)

Thanks

Romain

Keywords: angularjs,callback,jsonp

Metadata

Metadata

Assignees

Labels

BugFor errors / faults / flaws / inconsistencies etc.

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions