Skip to content

Commit

Permalink
Fix false negative for Spotify song with fully non-alphanumeric name (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
Brainicism authored Dec 8, 2023
1 parent 3d4438c commit 9406c52
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/helpers/spotify_manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -511,9 +511,11 @@ export default class SpotifyManager {

// handle songs with brackets in name, consider all components separately
const songNameBracketComponents = song.name.split("(");
const songNames = [songNameBracketComponents[0]];
const songNames = [songNameBracketComponents[0].trim()];
if (songNameBracketComponents.length > 1) {
songNames.push(songNameBracketComponents[1].replace(")", ""));
songNames.push(
songNameBracketComponents[1].replace(")", "").trim(),
);
songNames.push(song.name);
}

Expand Down Expand Up @@ -542,7 +544,7 @@ export default class SpotifyManager {
eb(
"available_songs.clean_song_name_alpha_numeric",
"like",
songName.replace(/[^0-9a-z]/gi, ""),
songName.replace(/[^0-9a-z]/gi, "") || songName,
),
),
),
Expand Down

0 comments on commit 9406c52

Please sign in to comment.