From 8723bc889078457daad5855f441345ec60d2c668 Mon Sep 17 00:00:00 2001 From: FoxxMD Date: Tue, 4 Aug 2026 18:29:41 +0000 Subject: [PATCH] fix(lfm endpoint): Improve regex slug matching to handle more variants --- src/backend/sources/EndpointLastfmSource.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/backend/sources/EndpointLastfmSource.ts b/src/backend/sources/EndpointLastfmSource.ts index c3569e3a..a6ce061a 100644 --- a/src/backend/sources/EndpointLastfmSource.ts +++ b/src/backend/sources/EndpointLastfmSource.ts @@ -17,8 +17,8 @@ import type {PlayerStateOptions} from "./PlayerState/AbstractPlayerState.ts"; import { NowPlayingPlayerState } from "./PlayerState/NowPlayingPlayerState.ts"; import { parseRegexSingle } from "@foxxmd/regex-buddy-core"; -const noSlugMatch = new RegExp(/(?:\/api\/lastfm\/?)$|(?:\/1\/?|\/2.0\/?)$/i); -const slugMatch = new RegExp(/\/api\/lastfm\/([^\/]+)\/?$/i); +const noSlugMatch = new RegExp(/(?:\/api\/lastfm\/?)$|(?:^\/1\/?|^\/2.0\/?)$/i); +const slugMatch = new RegExp(/\/api\/lastfm\/([^\/]+)(\/|\/2.0\/)?$/i); export const authHeaderRegex = new RegExp(/Token (.+)$/i); -- 2.51.2