From 1daf68206203d4a61062fba8fcbe22c668f8fba9 Mon Sep 17 00:00:00 2001 From: KaNaDaAT Date: Thu, 15 May 2025 20:48:11 +0200 Subject: [PATCH] fix: spotify regex pattern Fix regex pattern to use non-capturing group for optional intl prefix in Spotify track URLs --- server/spotify/spotify.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/server/spotify/spotify.go b/server/spotify/spotify.go index f9f021a..204a5c6 100644 --- a/server/spotify/spotify.go +++ b/server/spotify/spotify.go @@ -183,9 +183,9 @@ func isValidPattern(url, pattern string) bool { } func TrackInfo(url string) (*Track, error) { - re := regexp.MustCompile(`open\.spotify\.com\/track\/([a-zA-Z0-9]{22})`) + re := regexp.MustCompile(`open\.spotify\.com\/(?:intl-.+\/)?track\/([a-zA-Z0-9]{22})(\?si=[a-zA-Z0-9]{16})?`) matches := re.FindStringSubmatch(url) - if len(matches) != 2 { + if len(matches) <= 2 { return nil, errors.New("invalid track URL") } id := matches[1]