From a07019851ea28ec7b35ae3d8d50f90fe7897e989 Mon Sep 17 00:00:00 2001 From: Broque Thomas Date: Tue, 30 Dec 2025 10:39:22 -0800 Subject: [PATCH] Update web_server.py --- web_server.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/web_server.py b/web_server.py index 4d3b9a5a..55447156 100644 --- a/web_server.py +++ b/web_server.py @@ -9537,12 +9537,15 @@ def remove_album_from_wishlist(): track_album_id = spotify_data.get('album', {}).get('id') if not track_album_id: - # Create custom ID matching frontend logic: album_name_artist_name (lowercase, consecutive spaces -> single underscore) + # Create custom ID matching frontend logic exactly album_name = spotify_data.get('album', {}).get('name', 'Unknown Album') artist_name = spotify_data.get('artists', [{}])[0].get('name', 'Unknown Artist') if spotify_data.get('artists') else 'Unknown Artist' custom_id = f"{album_name}_{artist_name}" - # Match frontend regex: /\s+/g -> replace consecutive whitespace with single underscore - track_album_id = re.sub(r'\s+', '_', custom_id).lower() + # Match frontend regex exactly: + # 1. Remove all special chars except spaces, underscores, hyphens: /[^a-zA-Z0-9\s_-]/g + # 2. Replace consecutive whitespace with single underscore: /\s+/g + track_album_id = re.sub(r'[^a-zA-Z0-9\s_-]', '', custom_id) # Remove special chars + track_album_id = re.sub(r'\s+', '_', track_album_id).lower() # Replace spaces & lowercase # Match by album ID if track_album_id == album_id: