My favorites | Sign in
Project Home Downloads Wiki Issues Source
New issue   Search
for
  Advanced search   Search tips   Subscriptions
Issue 2006: gerrit /projects REST API returns invalid json
2 people starred this issue and may be notified of changes. Back to list
Status:  WontFix
Owner:  ----
Closed:  Jul 2013


Sign in to add a comment
 
Reported by amu...@wikimedia.org, Jul 11, 2013
Affected Version: 2.7-rc2-727-g1afdb30 ( https://android-review.googlesource.com/ )

What steps will reproduce the problem?
1. Query a list of projects using the REST API, ie curl 'https://android-review.googlesource.com/projects/?type=code&p=device/common'
2. Look at the beginning of the output, the string ")]}'" (without double quotes) is prepended before the json input
3. A script using json decoding would throw an error about the input being invalid json, thus we have to preprocess the content served by Gerrit.

Step to reproduce:

 $ curl 'https://android-review.googlesource.com/projects/?type=code&p=device/common'

What is the expected output? 

{
  "device/common": {
    "kind": "gerritcodereview#project",
    "id": "device%2Fcommon"
  }
}

What do you see instead?

)]}'
{
  "device/common": {
    "kind": "gerritcodereview#project",
    "id": "device%2Fcommon"
  }
}
$

Jul 11, 2013
Project Member #1 edwin.ke...@gmail.com
The ")]}'" prefix in the JSON response is intended [1] and your script needs to skip it. It's a security measure to prevent XSSI.

[1] http://gerrit-documentation.googlecode.com/svn/Documentation/2.6/rest-api.html#output
Status: WontFix
Jul 11, 2013
#2 amu...@wikimedia.org
Thank you Edwin, I should really have looked at the doc first :-D
Sign in to add a comment

Powered by Google Project Hosting