From d89d8be1893867b308c65f5e88f724bd83a6cc7a Mon Sep 17 00:00:00 2001 From: ltctceplrm <14954927+ltctceplrm@users.noreply.github.com> Date: Tue, 11 Feb 2025 22:05:57 +0100 Subject: [PATCH] Fixed bug when publisher field was null --- src/api/apis/ComicVineAPI.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/api/apis/ComicVineAPI.ts b/src/api/apis/ComicVineAPI.ts index c45da4e..6cfad99 100644 --- a/src/api/apis/ComicVineAPI.ts +++ b/src/api/apis/ComicVineAPI.ts @@ -40,8 +40,8 @@ export class ComicVineAPI extends APIModel { englishTitle: result.name, year: result.start_year, dataSource: this.apiName, - id: result.id, - publishers: result.publisher.name ?? [], + id: `4050-${result.id}`, + publishers: result.publisher?.name ?? [], }), ); } @@ -52,7 +52,7 @@ export class ComicVineAPI extends APIModel { async getById(id: string): Promise { console.log(`MDB | api "${this.apiName}" queried by ID`); - const searchUrl = `${this.apiUrl}/volume/4050-${encodeURIComponent(id)}/?api_key=${this.plugin.settings.ComicVineKey}&format=json`; + const searchUrl = `${this.apiUrl}/volume/${encodeURIComponent(id)}/?api_key=${this.plugin.settings.ComicVineKey}&format=json`; const fetchData = await requestUrl({ url: searchUrl, }); @@ -76,7 +76,7 @@ export class ComicVineAPI extends APIModel { year: result.start_year ?? '', dataSource: this.apiName, url: result.site_detail_url, - id: result.id, + id: `4050-${result.id}`, authors: result.people?.map((x: any) => x.name) ?? [], @@ -84,7 +84,7 @@ export class ComicVineAPI extends APIModel { image: result.image?.original_url ?? '', released: true, - publishers: result.publisher.name ?? [], + publishers: result.publisher?.name ?? [], publishedFrom: result.start_year ?? 'unknown', publishedTo: 'unknown', status: result.status,