Skip to content

sanitize listname before formatting#2560

Open
tomdec wants to merge 2 commits intospotDL:devfrom
tomdec:sanitize-m3u-before-formatting
Open

sanitize listname before formatting#2560
tomdec wants to merge 2 commits intospotDL:devfrom
tomdec:sanitize-m3u-before-formatting

Conversation

@tomdec
Copy link

@tomdec tomdec commented Nov 5, 2025

This is my first PR to an opensource project, so please let me know if I forgot something! :)

Title

Also sanitizes the injected list_name to prevent / characters in this name from creating unwanted directories.

Description

called the sanitize_string function on the inject list_name before replacing {list} or {list[idx]}.
Also added a rule to the sanitize_string function to remove double spaces (created by removing characters).

Related Issue

#2284

Motivation and Context

How Has This Been Tested?

I ran the tests on WSL in windows by running pytest in the cli, and using and extension in vs code.

Added a test that calls the gen_m3u_files with a list of songs that have "something / or other" as list_name.
Also tested it manually by downloading a spotify playlist with a / in the name.

Was going to evaluate the test results in GitHub to for other failing tests, because the tests in the master branch also have some failures locally.

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
    Pylint was happy, formatting with black is applied.
    For mypy, the first command ran successfully without errors, but then running just mypy ./spotdl did give some errors about missing library stubs, did the first command not create them all? Or is there another way to create them all?
  • My change requires a change to the documentation
    I don't think any changes altered expected functionality.
  • 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
    I still have some failing tests when running all tests.
    Some I could fix with updating yt-dlp to 2025-10-22, but I have not committed this, am I allowed to update these dependencies?
    Most remaining failing tests had to do with CannotOverwriteExistingCassetteException and ContentDecodingError errors, which I'm not certain about how to fix.

@Silverarmor Silverarmor changed the base branch from master to dev March 8, 2026 07:53
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.

1 participant