Skip to content

fix: handle playlists with slashes in their names#2534

Merged
Silverarmor merged 2 commits intospotDL:devfrom
w3Abhishek:master
Oct 26, 2025
Merged

fix: handle playlists with slashes in their names#2534
Silverarmor merged 2 commits intospotDL:devfrom
w3Abhishek:master

Conversation

@w3Abhishek
Copy link

Title

Fix: handle playlists with slashes in their names

Description

This PR fixes an issue where playlists containing slashes in their names would cause a FileNotFoundError when creating M3U files. The fix works by:

  • Creates parent directories as needed before writing M3U files to prevent the FileNotFoundError

Related Issue

Fixes #2284

Motivation and Context

When a playlist name contained slashes like "init 3 - Neutral/Happy", the sanitize_string function would remove the slashes completely, resulting in filenames like "init 3 - NeutralHappy.m3u8". Additionally, if the directory structure didn't exist, the program would crash with a FileNotFoundError when trying to create the M3U file.

How Has This Been Tested?

Tested on Windows with playlist names containing slashes. The changes ensure that:

  • M3U files are created successfully without errors

Screenshots (if appropriate)

image

Types of Changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist

  • My code follows the code style of this project
  • My change requires a change to the documentation
  • I have updated the documentation accordingly
  • I have read the CONTRIBUTING document
  • I have added tests to cover my changes
  • All new and existing tests passed

@Silverarmor Silverarmor changed the base branch from master to dev October 11, 2025 22:56
@Silverarmor Silverarmor requested a review from Copilot October 11, 2025 22:56
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR fixes a bug where playlists with slashes in their names would cause FileNotFoundError when creating M3U files. The fix ensures parent directories are created before writing the M3U file.

  • Adds directory creation to handle nested paths from playlist names containing slashes
  • Prevents FileNotFoundError when the directory structure doesn't exist

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@Silverarmor
Copy link
Member

Please stop mentioning me on all platforms. I am human. I have more important things in life to prioritise and my work on spotDL is volunteer hours on top of that. I will get to it when I can, please be patient.
If you are worried about hacktoberfest, I will action the outstanding PRs during october and either merge them or tag as hacktoberfest-accepted.

@Silverarmor Silverarmor merged commit 151c653 into spotDL:dev Oct 26, 2025
1 of 8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

FileNotFoundError when a playlists contains slashes on its name

3 participants