From a6422bb3fccc54bcda74baad735ac837582367d7 Mon Sep 17 00:00:00 2001 From: Vito0912 <86927734+Vito0912@users.noreply.github.com> Date: Sat, 1 Mar 2025 20:31:45 +0100 Subject: [PATCH] fixed CodeQL --- server/finders/BookFinder.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/server/finders/BookFinder.js b/server/finders/BookFinder.js index e058082a..08b1466e 100644 --- a/server/finders/BookFinder.js +++ b/server/finders/BookFinder.js @@ -204,7 +204,11 @@ class BookFinder { * @returns {Promise} */ async getAudiMetaResults(title, author, asin, provider) { - const region = provider.includes('.') ? provider.split('.').pop() : '' + // Ensure provider is a string (See CodeQL) even though it should be a string anyway + const providerStr = (typeof provider === 'string' ? provider : + (Array.isArray(provider) ? provider[0]?.toString() || '' : '')).toString() + + const region = providerStr.includes('.') ? providerStr.split('.').pop() : '' const books = await this.audiMeta.search(title, author, asin, region, this.#providerResponseTimeout) if (this.verbose) Logger.debug(`Audible Book Search Results: ${books.length || 0}`) if (!books) return []