JS API response incorrectly formatted


(Talk) #1

Hey all,

 

Running Matrix 5.1.2.1

 

Hitting the JS API getChildren command returns an array of objects, and, in some cases, an error object too. The problem is, that the error object breaks the formatting, so:

{"error":"Malformed UTF-8 characters, possibly incorrectly encoded","errorCode":"internalError"}[{"..."},{"..."}]

^ is missing the semicolon after the error object, or the response array is not wrapped in an object value.

 

This would be better:

{"error":"Malformed UTF-8 characters, possibly incorrectly encoded","errorCode":"internalError","response":[{"..."},{"..."}]}

Unfortunately this error can't be caught or handled at all, as the response is not correctly formatted javascript. Is there a patch we can apply to get the response correct?


(Bart Banda) #2

Hi Jeremy, I've had one of our developers look at this and they think it's a bug which has been logged in our Roadmap, https://squizmap.squiz.net/matrix/6991. 


(Luke Wright) #3

Hi Jeremy,

 

I'm the dev who had a look for you (as per Bart's message). In short, it's a valid bug, but I believe that it should be giving you an error -or- response because if it returns an error I would have thought the output would have then been nothing (echoing a FALSE). Squizmap #6991 has been added (as advised) as that will be changed so both can't be returned together.


(Talk) #4

Thanks guys, and thanks Luke for looking deeply into this for me! It's not a system from my signature though, I'll PM you the system in case you're keen to get more info. I can confirm it's returning both, and the data in the response itself seems to be valid.