My favorites | Sign in
Project Home Downloads Wiki Issues Source
New issue   Search
for
  Advanced search   Search tips   Subscriptions
Issue 3540: /changes API call returns invalid JSON
1 person starred this issue and may be notified of changes. Back to list
Status:  WontFix
Owner:  ----
Closed:  Aug 30


Sign in to add a comment
 
Reported by joshar...@gmail.com, Aug 30, 2015
What steps will reproduce the problem?

curl "https://go-review.googlesource.com/changes/13894/?o=CURRENT_REVISION"


What is the expected output? What do you see instead?

Expected: Valid JSON (or a useful error, I suppose).

Get:

)]}'
{
  "id": "go~dev.ssa~I990fb4e3fbe98850c6be35c3185a1c85d9e1a6ba",
  "project": "go",
  "branch": "dev.ssa",
  "hashtags": [],
  "change_id": "I990fb4e3fbe98850c6be35c3185a1c85d9e1a6ba",
  "subject": "[dev.ssa] cmd/runtime: generate gc bitmaps for SSA-compiled code",
  "status": "NEW",
  "created": "2015-08-24 17:01:55.201000000",
  "updated": "2015-08-29 20:05:37.656000000",
  "mergeable": true,
  "submittable": false,
  "insertions": 106,
  "deletions": 120,
  "_number": 13894,
  "owner": {
    "_account_id": 5200
  },
  "current_revision": "6ef1792315dfe4fa2567237141de60f7faaeb36b",
  "revisions": {
    "6ef1792315dfe4fa2567237141de60f7faaeb36b": {
      "_number": 3,
      "created": "2015-08-29 20:05:36.855000000",
      "uploader": {
        "_account_id": 5200
      },
      "ref": "refs/changes/94/13894/3",
      "fetch": {
        "http": {
          "url": "https://go.googlesource.com/go",
          "ref": "refs/changes/94/13894/3"
        }
      }
    }
  }
}

Observe the leading characters: )]}'

Aug 30, 2015
Project Member #1 edwin.ke...@gmail.com
> Observe the leading characters: )]}'

This prefix is intended. It's a security feature to prevent against Cross Site Script Inclusion (XSSI) attacks, see [1]. You must strip it off before parsing the json.

[1] https://gerrit-review.googlesource.com/Documentation/rest-api.html#output
Status: WontFix
Sign in to add a comment

Powered by Google Project Hosting