From c66bc18939399fdf84b7729d0ad6fd419a713ddd Mon Sep 17 00:00:00 2001 From: Andrea Calabrese Date: Mon, 28 Jul 2025 18:22:56 +0200 Subject: [PATCH] Avoid crash if thumbnail type not found With this, I want to avoid crashing when the thumbnail is not found. I also fixed the extension detection, now not using regexes. Signed-off-by: Andrea Calabrese --- src/scoreinfo.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/scoreinfo.ts b/src/scoreinfo.ts index 0781f81..5d6eba3 100644 --- a/src/scoreinfo.ts +++ b/src/scoreinfo.ts @@ -108,8 +108,9 @@ export abstract class SheetInfo { get imgType(): "svg" | "png" { const thumbnail = this.thumbnailUrl; - const imgtype = thumbnail.match(/score_0\.(\w+)/)![1]; - return imgtype as "svg" | "png"; + console.log("THUMBNAIL: " + thumbnail) + const imgtype = thumbnail.substring(thumbnail.lastIndexOf("."), thumbnail.length); + return imgtype; } }