QtDropbox
QtDropbox copied to clipboard
JSON parse bug
I've just discovered a bug in <I>QDropboxJson::parseString</I> function (qdropboxjson.cpp). The issue is that if json string contains [ character that is quoted, parser gets confused and sets <I>isArray=true </I>, but the value isn't really an array because it's string value under quotes.
The fix would be that under <I>switch(strJson.at(i).toLatin1()) </I> and <I>case '[':</I> the line <I>isArray=true </I> should be prefixed with <I>if (!openQuotes) </I>, so that <I>isArray</I> is not set if we're parsing quoted text. I've not tested this extensively, but for my case (dropbox folder with [ in it's name) it works OK.
Thanks
I will take a look at this issue within the next days. Thank you for reporting and investigating!
Also fixed parsing of curly brackets with the referenced commit.
Thanks for the fix, but I haven't tested curly brackets (until now) and unfortunately if folder name contains just one curly bracket (either one) parsing doesn't work OK. Solution is to prefix <I>inJson++;</I> and <I>inJson--;</I> under <I>case '{':</I> and <I>case '}':</I> in function <I>QDropboxJson::getArray</I> with <I>if (!inString)</I>
Thanks for testing!
Unfortunately I did not merge all changes into the master branch. This is why this still fails. I will add those changes sometime today.
Run into this problem today, this is not yet fixed (master branch).