Closed athalius closed 8 years ago
That test case is invalid. The importData function is doing what's supposed to do. Can you change it for another where it demonstrate the problem?
Whoops got a bit lazy in snipping.
{"mangas":"[{\"mirror\":\"Manga-Fox\",\"name\":\"1/2 Prince\",\"url\":\"http://mangafox.me/manga/1_2_prince/\",\"lastChapterReadURL\":\"http://mangafox.me/manga/1_2_prince/v14/c069/\",\"lastChapterReadName\":\"1/2 Prince 69\",\"read\":0,\"update\":1,\"ts\":1407828322,\"display\":0,\"cats\":\"[]\"}]","bookmarks":"[]"}
is a valid string that will be read ( or will blow up at least :))
Um... it worked fine? What is the issue I'm supposed to see?
well, sometimes it triggers an error (unexpected en of input) because of JSON.parse(obj.cats)
when cats is empty 'cause obj.cats is already a Json object ...
i fixed it locally by changing the MangaElt.js lines 122-124
if (obj.cats !== undefined && obj.cats !== null) {
this.cats = (typeof obj.cats ==='object')? obj.cats : JSON.parse(obj.cats) || [];
}
This should fix merges https://github.com/AllMangasReader-dev/AMR/issues/111 Trying to parse an array, that is already been parsed and instatntiated as an array is gonna blow up.
Test case:
{\"mirror\":\"Manga-Fox\",\"name\":\"1/2 Prince\",\"url\":\"http://mangafox.me/manga/1_2_prince/\",\"lastChapterReadURL\":\"http://mangafox.me/manga/1_2_prince/v14/c069/\",\"lastChapterReadName\":\"1/2 Prince 69\",\"read\":0,\"update\":1,\"ts\":1407828322,\"display\":0,\"cats\":\"[]\"},