aboutsummaryrefslogtreecommitdiffstats
path: root/gallery_dl/path.py
diff options
context:
space:
mode:
authorLibravatarUnit 193 <unit193@unit193.net>2024-08-03 20:27:44 -0400
committerLibravatarUnit 193 <unit193@unit193.net>2024-08-03 20:27:44 -0400
commit032e5bed275a253e122ed9ac86dac7b8c4204172 (patch)
treeb4eda52ebfe00c4d22e9d633b1ab2d158a9f0573 /gallery_dl/path.py
parent80e39a8fc7de105510cbbdca8507f2a4b8c9e01d (diff)
New upstream version 1.27.2.upstream/1.27.2
Diffstat (limited to 'gallery_dl/path.py')
-rw-r--r--gallery_dl/path.py11
1 files changed, 8 insertions, 3 deletions
diff --git a/gallery_dl/path.py b/gallery_dl/path.py
index 1616bbd..7892776 100644
--- a/gallery_dl/path.py
+++ b/gallery_dl/path.py
@@ -51,6 +51,7 @@ class PathFormat():
raise exception.FilenameFormatError(exc)
directory_fmt = config("directory")
+ self.directory_conditions = ()
try:
if directory_fmt is None:
directory_fmt = extractor.directory_fmt
@@ -266,7 +267,7 @@ class PathFormat():
try:
for fmt in self.directory_formatters:
segment = fmt(kwdict).strip()
- if strip:
+ if strip and segment != "..":
# remove trailing dots and spaces (#647)
segment = segment.rstrip(strip)
if segment:
@@ -288,7 +289,7 @@ class PathFormat():
formatters = self.directory_formatters
for fmt in formatters:
segment = fmt(kwdict).strip()
- if strip:
+ if strip and segment != "..":
segment = segment.rstrip(strip)
if segment:
append(self.clean_segment(segment))
@@ -344,7 +345,11 @@ class PathFormat():
continue
except OSError:
# move across different filesystems
- shutil.copyfile(self.temppath, self.realpath)
+ try:
+ shutil.copyfile(self.temppath, self.realpath)
+ except FileNotFoundError:
+ os.makedirs(self.realdirectory)
+ shutil.copyfile(self.temppath, self.realpath)
os.unlink(self.temppath)
break