summaryrefslogtreecommitdiff
path: root/tidal_dl_ng/download.py
diff options
context:
space:
mode:
authorRobert Honz <exislow+github@gmail.com>2025-02-28 16:57:18 +0100
committerRobert Honz <exislow+github@gmail.com>2025-02-28 16:57:18 +0100
commit7a4d6ceae776a8b9910902ca779f25ce2b78e558 (patch)
tree1a8d330f98bf935fa13702dfd2bb4e51347505af /tidal_dl_ng/download.py
parent56aff8fa19ef801c0582dbe37d2e689024303ed5 (diff)
downloadtidal-dl-ng-7a4d6ceae776a8b9910902ca779f25ce2b78e558.tar.gz
🛠️ Fixed path length sanitation. Also refactored the path helper to use `pathlib.Path` instead of str. Fixed #358
Diffstat (limited to 'tidal_dl_ng/download.py')
-rw-r--r--tidal_dl_ng/download.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/tidal_dl_ng/download.py b/tidal_dl_ng/download.py
index b623c18..c72977b 100644
--- a/tidal_dl_ng/download.py
+++ b/tidal_dl_ng/download.py
@@ -338,7 +338,7 @@ class Download:
).absolute()
# Sanitize final path_file to fit into OS boundaries.
- path_media_dst = pathlib.Path(path_file_sanitize(str(path_media_dst), adapt=True))
+ path_media_dst = pathlib.Path(path_file_sanitize(path_media_dst, adapt=True))
# Compute if and how downloads need to be skipped.
skip_download: bool = False
@@ -352,7 +352,7 @@ class Download:
path_media_track_dir: pathlib.Path = (
pathlib.Path(self.path_base).expanduser() / (file_name_track_dir_relative + file_extension_dummy)
).absolute()
- path_media_track_dir = pathlib.Path(path_file_sanitize(str(path_media_track_dir), adapt=True))
+ path_media_track_dir = pathlib.Path(path_file_sanitize(path_media_track_dir, adapt=True))
file_exists_track_dir: bool = check_file_exists(path_media_track_dir, extension_ignore=False)
file_exists_playlist_dir: bool = (
not file_exists_track_dir and skip_file and not path_media_dst.is_symlink()
@@ -404,7 +404,7 @@ class Download:
# Compute file name, sanitize once again and create destination directory
path_media_dst = path_media_dst.with_suffix(file_extension)
- path_media_dst = pathlib.Path(path_file_sanitize(str(path_media_dst), adapt=True))
+ path_media_dst = pathlib.Path(path_file_sanitize(path_media_dst, adapt=True))
os.makedirs(path_media_dst.parent, exist_ok=True)
if not skip_download:
@@ -493,7 +493,7 @@ class Download:
path_media_dst: pathlib.Path = (
pathlib.Path(self.path_base).expanduser() / (file_name_relative + file_extension)
).absolute()
- path_media_dst = pathlib.Path(path_file_sanitize(str(path_media_dst), adapt=True))
+ path_media_dst = pathlib.Path(path_file_sanitize(path_media_dst, adapt=True))
os.makedirs(path_media_dst.parent, exist_ok=True)