diff --git a/web_server.py b/web_server.py index 14a48612..b126a3f6 100644 --- a/web_server.py +++ b/web_server.py @@ -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 diff --git a/webui/static/script.js b/webui/static/script.js index b3e71b91..ba0638fb 100644 --- a/webui/static/script.js +++ b/webui/static/script.js @@ -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 //'); }