JS API Batch bug


(Talk) #1

Hi all,

 

Running Matrix 4.16.2

 

Just noticed some batch responses are mis-formatted when one item contains a minor error (and that typo):

{
    "error": "Unable to set Matadata for Asset #XXXXX
}[{ // << Here
    "success": ["Metadata field #XXXX has been successfully set to \"\" for Asset \”ASSET NAME\” (#XXXX)”]
}, {
    "success": ["Metadata field #XXXX has been successfully set to \"<p>Testing 123<\/p>\" for Asset \"ASSET NAME\” (#XXXX)”]
}, {
    "success": ["Metadata field #XXXX has been successfully set to \"\" for Asset \”ASSET NAME\” (#XXXX)”]
}]

This causes browsers to fail at the callback stage, and the script cannot recover:

Uncaught SyntaxError: Unexpected token [ jsapi.js:24 jsonToObj jsapi.js:24 http.onreadystatechange

Is this something that's come up before?


(Anthony Ponomarenko) #2

Hi Jeremy,

 

This was indeed found as a bug and was fixed for 4.16.6.

 

The report can be found here: http://bugs.matrix.squiz.net/view_bug.php?bug_id=6688