janelia-flyem / dvid

Distributed, Versioned, Image-oriented Dataservice
http://dvid.io
Other
197 stars 33 forks source link

/keyvalues?json=true returns invalid json #356

Closed stuarteberg closed 2 years ago

stuarteberg commented 3 years ago

It looks like the very last byte is missing from the returned responses. Here's an example:

$ URL='http://emdata5.janelia.org:8400/api/node/b31220/segmentation_annotations/keyvalues?json=true'
$ curl -X GET  -H "Content-Type: application/json" --data '["10000"]' ${URL}

{"10000":{"body ID": 10000, "status": "Prelim Roughly traced", "user": "ribeiroc", "naming user": "takemuras", "instance": "Giant Fiber_R"}

Notice that the response should end with TWO } characters, not one.

stuarteberg commented 3 years ago

Looks like there's an additional issue besides the missing } character. Here's an example:

$ URL='http://emdata5.janelia.org:8400/api/node/b31220/segmentation_annotations/keyvalues?json=true'
$ curl -X GET  -H "Content-Type: application/json" --data '["22453", "12609"]' ${URL}

{"22453":{"body ID": 22453, "status": "Prelim Roughly traced", "user": "phillipse"},

I asked for two keys, but one of them doesn't actually exist. What should happen in that case? In the example above, only one result was returned, but it ends with a trailing , character, so merely appending a } character won't result in valid JSON.