Allow flat single path templates with no subfolder
Singles could not be saved as a flat file (e.g. "$artist - $title") because the frontend blocked any template without a "/" and the backend path builder treated an empty folder_path as falsy, falling through to the hardcoded nested-folder structure. Frontend: removed the must-include-slash validation for single templates only (album templates still require it). Backend: changed condition from `if folder_path and filename_base` to `if filename_base` so an empty folder_path is handled correctly as a flat drop into the transfer root.
This commit is contained in:
parent
1071b2ebe5
commit
3db00ca7ef
2 changed files with 9 additions and 6 deletions
|
|
@ -17424,9 +17424,14 @@ def _build_final_path_for_track(context, spotify_artist, album_info, file_ext):
|
|||
}
|
||||
|
||||
folder_path, filename_base = _get_file_path_from_template(template_context, 'single_path')
|
||||
if folder_path and filename_base:
|
||||
final_path = os.path.join(transfer_dir, folder_path, filename_base + file_ext)
|
||||
os.makedirs(os.path.join(transfer_dir, folder_path), exist_ok=True)
|
||||
if filename_base:
|
||||
# folder_path may be '' for flat templates like "$artist - $title" (no subfolders)
|
||||
if folder_path:
|
||||
final_path = os.path.join(transfer_dir, folder_path, filename_base + file_ext)
|
||||
os.makedirs(os.path.join(transfer_dir, folder_path), exist_ok=True)
|
||||
else:
|
||||
final_path = os.path.join(transfer_dir, filename_base + file_ext)
|
||||
os.makedirs(transfer_dir, exist_ok=True)
|
||||
return final_path, True
|
||||
else:
|
||||
# Fallback
|
||||
|
|
|
|||
|
|
@ -5562,9 +5562,7 @@ function validateFileOrganizationTemplates() {
|
|||
if (singlePath.startsWith('/')) {
|
||||
errors.push('Single template cannot start with /');
|
||||
}
|
||||
if (!singlePath.includes('/')) {
|
||||
errors.push('Single template must include at least one folder (use / separator)');
|
||||
}
|
||||
// Note: single template is allowed to have no slash (flat file: "$artist - $title")
|
||||
if (singlePath.includes('//')) {
|
||||
errors.push('Single template cannot have consecutive slashes //');
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue