QtDropbox icon indicating copy to clipboard operation
QtDropbox copied to clipboard

JSON parse bug

Open filippz opened this issue 10 years ago • 5 comments

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

filippz avatar Apr 15 '14 16:04 filippz

I will take a look at this issue within the next days. Thank you for reporting and investigating!

lycis avatar Apr 15 '14 19:04 lycis

Also fixed parsing of curly brackets with the referenced commit.

lycis avatar Apr 21 '14 09:04 lycis

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>

filippz avatar Apr 21 '14 18:04 filippz

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.

lycis avatar Apr 22 '14 06:04 lycis

Run into this problem today, this is not yet fixed (master branch).

Lu-Gru avatar Dec 13 '15 18:12 Lu-Gru