mirror of
https://github.com/jakejarvis/sofa.git
synced 2026-10-16 01:05:42 -04:00
fix(imports): tolerate a UTF-8 BOM in uploaded Trakt JSON
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
2 files changed
+19
-2
No files matched your search
@@ -1362,6 +1362,18 @@ describe("parseTraktExport", () => {
|
||||
);
|
||||
});
|
||||
|
||||
test("accepts a JSON file with a UTF-8 byte-order mark", async () => {
|
||||
const bytes = new Uint8Array([
|
||||
0xef,
|
||||
0xbb,
|
||||
0xbf,
|
||||
...new TextEncoder().encode(JSON.stringify(historyItems)),
|
||||
]);
|
||||
const result = await parseTraktExport(new Blob([bytes], { type: "application/json" }));
|
||||
expect(result.data.movies).toHaveLength(1);
|
||||
expect(result.data.episodes).toHaveLength(1);
|
||||
});
|
||||
|
||||
test("skips an unparsable JSON entry inside the ZIP", async () => {
|
||||
const zip = createZip({
|
||||
"watched-history-1.json": JSON.stringify(historyItems),
|
||||
|
||||
Reference in new issue
Block a user