[GH-ISSUE #213] Download is failing when there is space at the end of the playlist name #1478

Closed
opened 2026-03-13 18:34:27 +03:00 by kerem · 1 comment
Owner

Originally created by @zappthed on GitHub (Dec 31, 2025).
Original GitHub issue: https://github.com/afkarxyz/SpotiFLAC/issues/213

Image

Download is failing when there is space at the end of the playlist name, as Windows automatically deletes the space in the name at the end of a folder automatically.

[23:35:46] [info] fetching playlist metadata...
[23:35:46] [debug] url: https://open.spotify.com/playlist/6gvxj5vfqngrheyb4eplhn
[23:35:49] [success] fetched playlist: 139 tracks
[23:35:49] [debug] by joselle catolico
[23:35:49] [info] fetch completed in 2.48s
[23:35:49] [success] metadata fetched successfully
[23:35:58] [info] starting download: get you (feat. kali uchis) - daniel caesar, kali uchis
[23:35:58] [debug] trying tidal for: get you (feat. kali uchis) - daniel caesar, kali uchis
[23:36:00] [error] tidal error: failed to create file: open c:\users\zappthed\music\daniel caesar, etc. \get you (feat. kali uchis) - daniel caesar, kali uchis.flac: the system cannot find the path specified.
[23:36:00] [debug] trying amazon for: get you (feat. kali uchis) - daniel caesar, kali uchis
[23:36:17] [error] amazon error: all regions failed. last error: failed to create file: open c:\users\zappthed\music\daniel caesar, etc. \daniel caesar - get you (feat. kali uchis).flac: the system cannot find the path specified.
[23:36:17] [debug] trying qobuz (fallback) for: get you (feat. kali uchis) - daniel caesar, kali uchis
[23:36:20] [error] download failed

failed to create file: open c:\users\zappthed\music\daniel caesar, etc. \get you (feat. kali uchis) - daniel caesar, kali uchis.flac: the system cannot find the path specified.
It shows folder directory with space at

...\daniel caesar, etc. \...

When it should've been

...\daniel caesar, etc.\...

Originally created by @zappthed on GitHub (Dec 31, 2025). Original GitHub issue: https://github.com/afkarxyz/SpotiFLAC/issues/213 <img width="1024" height="600" alt="Image" src="https://github.com/user-attachments/assets/599e3bf3-ccdf-4726-b83b-b975a12d7a51" /> Download is failing when there is space at the end of the playlist name, as Windows automatically deletes the space in the name at the end of a folder automatically. ``` [23:35:46] [info] fetching playlist metadata... [23:35:46] [debug] url: https://open.spotify.com/playlist/6gvxj5vfqngrheyb4eplhn [23:35:49] [success] fetched playlist: 139 tracks [23:35:49] [debug] by joselle catolico [23:35:49] [info] fetch completed in 2.48s [23:35:49] [success] metadata fetched successfully [23:35:58] [info] starting download: get you (feat. kali uchis) - daniel caesar, kali uchis [23:35:58] [debug] trying tidal for: get you (feat. kali uchis) - daniel caesar, kali uchis [23:36:00] [error] tidal error: failed to create file: open c:\users\zappthed\music\daniel caesar, etc. \get you (feat. kali uchis) - daniel caesar, kali uchis.flac: the system cannot find the path specified. [23:36:00] [debug] trying amazon for: get you (feat. kali uchis) - daniel caesar, kali uchis [23:36:17] [error] amazon error: all regions failed. last error: failed to create file: open c:\users\zappthed\music\daniel caesar, etc. \daniel caesar - get you (feat. kali uchis).flac: the system cannot find the path specified. [23:36:17] [debug] trying qobuz (fallback) for: get you (feat. kali uchis) - daniel caesar, kali uchis [23:36:20] [error] download failed ``` `failed to create file: open c:\users\zappthed\music\daniel caesar, etc. \get you (feat. kali uchis) - daniel caesar, kali uchis.flac: the system cannot find the path specified. ` It shows folder directory with space at > ...\daniel caesar, etc. \\... When it should've been > ...\daniel caesar, etc.\\...
kerem closed this issue 2026-03-13 18:34:32 +03:00
Author
Owner

@SjxSubham commented on GitHub (Jan 1, 2026):

Well, I have found the root cause of this ISsue and approached a solution too that will fix the ISSUE everywhere.

Based on my analysis
The problem is at sanitizePath function inside the utills.ts file . This fn only removes invalid characters from folder names, but it does not trim trailing spaces from the path.

@afkarxyz A single line of change can fix it. Although I'm raising a PR regarding the fixes Let me know should i make contribute in this repo via this change or You alone can fix it your next update ...!

sanitizePath This function is called in multiple places throughout the codebase (in useDownload.ts, useLyrics.ts, and useCover.ts) when building the output directory path for playlist downloads, so I think fixing it in utils.ts will resolve the issue everywhere.

<!-- gh-comment-id:3703252817 --> @SjxSubham commented on GitHub (Jan 1, 2026): Well, I have found the root cause of this ISsue and approached a solution too that will fix the ISSUE everywhere. Based on my analysis The problem is at `sanitizePath` function inside the `utills.ts` file . This fn only removes invalid characters from folder names, but it **does not trim trailing spaces** from the path. @afkarxyz A single line of change can fix it. Although I'm raising a PR regarding the fixes Let me know should i make contribute in this repo via this change or You alone can fix it your next update ...! `sanitizePath` This function is called in multiple places throughout the codebase (in useDownload.ts, useLyrics.ts, and useCover.ts) when building the output directory path for playlist downloads, so I think fixing it in utils.ts will resolve the issue everywhere.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/SpotiFLAC#1478
No description provided.