[PR #108] [MERGED] Fix batch downloads ignoring selected filename format and preserve leading/trailing underscores #222

Closed
opened 2026-03-01 17:28:43 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/afkarxyz/SpotiDownloader/pull/108
Author: @Laynholt
Created: 2/25/2026
Status: Merged
Merged: 2/25/2026
Merged by: @afkarxyz

Base: mainHead: main


📝 Commits (2)

  • beb1933 Fix filename template in batch downloads
  • dc10f90 Preserve boundary underscores in sanitized names

📊 Changes

3 files changed (+4 additions, -4 deletions)

View changed files

📝 backend/filemanager.go (+1 -1)
📝 backend/filename.go (+1 -1)
📝 frontend/src/hooks/useDownload.ts (+2 -2)

📄 Description

This PR combines two fixes related to filename generation and sanitization.

1. Batch “Download All” now respects the selected filename template

Previously, batch downloads always produced files in Title - Artist format because they relied on the legacy settings.filenameFormat field. This PR updates batch download requests to use the current setting, settings.filenameTemplate, so “Download All” follows the user’s chosen filename format/template.

Change:

  • useDownload.ts: use settings.filenameTemplate (current setting) instead of legacy settings.filenameFormat in batch download requests.

Result:

  • Batch downloads now respect the selected filename format/template.

2. Preserve leading/trailing underscores during sanitization

This PR fixes an issue where underscores at the boundaries of generated names were removed during sanitization/rename generation.

Example (before):

  • Spotify\Tes_T_Name_\_fo became Spotify\Tes_T_Name\fo

Example (after):

  • Spotify\Tes_T_Name_\_fo is preserved correctly

Changes:

  • backend/filename.go: SanitizeFilename no longer trims _ (trims spaces only)
  • backend/filemanager.go: stop trimming _ when generating rename filenames

Result:

  • Leading/trailing underscores are preserved in path segments and filenames
  • Download naming and File Manager renaming behave consistently with underscores

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/afkarxyz/SpotiDownloader/pull/108 **Author:** [@Laynholt](https://github.com/Laynholt) **Created:** 2/25/2026 **Status:** ✅ Merged **Merged:** 2/25/2026 **Merged by:** [@afkarxyz](https://github.com/afkarxyz) **Base:** `main` ← **Head:** `main` --- ### 📝 Commits (2) - [`beb1933`](https://github.com/afkarxyz/SpotiDownloader/commit/beb1933522552647c5f37b063543f7b80a2c4f0e) Fix filename template in batch downloads - [`dc10f90`](https://github.com/afkarxyz/SpotiDownloader/commit/dc10f9030715981ac29fc32f31dd673f89b50a2f) Preserve boundary underscores in sanitized names ### 📊 Changes **3 files changed** (+4 additions, -4 deletions) <details> <summary>View changed files</summary> 📝 `backend/filemanager.go` (+1 -1) 📝 `backend/filename.go` (+1 -1) 📝 `frontend/src/hooks/useDownload.ts` (+2 -2) </details> ### 📄 Description This PR combines two fixes related to filename generation and sanitization. ### 1. **Batch “Download All” now respects the selected filename template** Previously, batch downloads always produced files in `Title - Artist` format because they relied on the legacy `settings.filenameFormat` field. This PR updates batch download requests to use the current setting, `settings.filenameTemplate`, so “Download All” follows the user’s chosen filename format/template. Change: * `useDownload.ts`: use `settings.filenameTemplate` (current setting) instead of legacy `settings.filenameFormat` in batch download requests. Result: * Batch downloads now respect the selected filename format/template. ### 2. **Preserve leading/trailing underscores during sanitization** This PR fixes an issue where underscores at the boundaries of generated names were removed during sanitization/rename generation. Example (before): * `Spotify\Tes_T_Name_\_fo` became `Spotify\Tes_T_Name\fo` Example (after): * `Spotify\Tes_T_Name_\_fo` is preserved correctly Changes: * `backend/filename.go`: `SanitizeFilename` no longer trims `_` (trims spaces only) * `backend/filemanager.go`: stop trimming `_` when generating rename filenames Result: * Leading/trailing underscores are preserved in path segments and filenames * Download naming and File Manager renaming behave consistently with underscores --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-03-01 17:28:43 +03:00
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/SpotiDownloader#222
No description provided.