From eda4d685176491514f9b3eb1203df3319d4b6451 Mon Sep 17 00:00:00 2001 From: itouakirai <85016486+itouakirai@users.noreply.github.com> Date: Tue, 26 Aug 2025 06:02:45 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E7=BB=9D=E5=AF=B9=E8=B7=AF=E5=BE=84?= =?UTF-8?q?=E9=94=99=E8=AF=AF=E5=8F=98=E4=B8=BA=E7=9B=B8=E5=AF=B9=E8=B7=AF?= =?UTF-8?q?=E5=BE=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/utils.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/utils.py b/src/utils.py index 121ca4d..59098fc 100644 --- a/src/utils.py +++ b/src/utils.py @@ -195,7 +195,12 @@ def get_song_name_and_dir_path(codec: str, metadata, playlist: PlaylistInfo = No dir_path = Path(it(Config).download.dirPathFormat.format(codec=codec, **safe_meta)) song_name = get_valid_filename(song_name) - dir_path = Path(*[get_valid_dir_name(part) if ":\\" not in part else part for part in dir_path.parts]) + is_abs = dir_path.is_absolute() + sanitized_parts = [ + part if i == 0 and is_abs else get_valid_dir_name(part) + for i, part in enumerate(dir_path.parts) + ] + dir_path = Path(*sanitized_parts) return song_name, dir_path