From d6c131fe2eda1538e84b2c44e12ddda0ead5ed21 Mon Sep 17 00:00:00 2001 From: "Navy.gif" Date: Sun, 14 Apr 2024 11:38:48 +0300 Subject: [PATCH] Fixed bug when searching for existing songs whose name contains a period --- src/client/components/downloaders/Spotify.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/client/components/downloaders/Spotify.ts b/src/client/components/downloaders/Spotify.ts index edc6a45..b18dd25 100644 --- a/src/client/components/downloaders/Spotify.ts +++ b/src/client/components/downloaders/Spotify.ts @@ -188,8 +188,11 @@ class SpotifyDownloader extends Downloader #parseFilename (fileName: string) { - const [ name, ext ] = fileName.split('.'); - const [ artist, song, album ] = name.split('---').map(str => str.trim()); + const match = fileName.match(/(?.+)\W---\W(?.+)\W---\W(?.+)(?\.\w+)$/u); + if (!match || !match.groups) + throw new Error('Unknown file name format'); + + const { artist, song, album, ext } = match.groups; return { fileName, artist,