From 5d7f5b76efd450a175501bd3c8735bb9de7121bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=B2=81=E6=A0=91=E4=BA=BA?= Date: Mon, 25 Dec 2023 18:15:51 +0100 Subject: [PATCH] fix: qmcv2 db name matching when `musicex` was not found --- src/decrypt-worker/worker/handler/qmcv2_parser.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/decrypt-worker/worker/handler/qmcv2_parser.ts b/src/decrypt-worker/worker/handler/qmcv2_parser.ts index 44dab27..91db211 100644 --- a/src/decrypt-worker/worker/handler/qmcv2_parser.ts +++ b/src/decrypt-worker/worker/handler/qmcv2_parser.ts @@ -10,6 +10,7 @@ export const workerParseMusicExMediaName = async ({ id, blobURI }: FetchMusicExN const blob = await timedLogger(`${label}/fetch-src`, async () => fetch(blobURI, { headers: { Range: 'bytes=-1024' } }).then((r) => r.blob()), ); + const buffer = await timedLogger(`${label}/read-src`, async () => { // Firefox: the range header does not work...? const blobBuffer = await blob.arrayBuffer(); @@ -18,10 +19,12 @@ export const workerParseMusicExMediaName = async ({ id, blobURI }: FetchMusicExN } return blobBuffer; }); + const parsed = makeQMCv2FooterParser(parakeet).parse(buffer); if (parsed.state === FooterParserState.OK) { return parsed.mediaName; } - return '# N/A'; + + return null; }); };