Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

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

Closed
anonymous-piwik-user opened this Issue · 1 comment

2 participants

Anonymous Piwik user Matthieu Aubry
Anonymous Piwik 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 :


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

Matthieu Aubry
Owner

In 96ac588: Fixes #4560: Piwik API can be used with AngularJS JSONP callback
Thanks for the report & fix!

Anonymous Piwik user anonymous-piwik-user added this to the 2.1 - Piwik 2.1 milestone
Philip Taffner sabl0r referenced this issue from a commit in sabl0r/piwik
Matthieu Aubry mattab Fixes #4560: Piwik API can be used with AngularJS JSONP callback
Thanks for the report & fix!
96ac588
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.