aboutsummaryrefslogtreecommitdiffstats
path: root/gallery_dl/path.py
diff options
context:
space:
mode:
authorLibravatarUnit 193 <unit193@unit193.net>2022-12-24 17:14:46 -0500
committerLibravatarUnit 193 <unit193@unit193.net>2022-12-24 17:14:46 -0500
commitebdfcd3cd3f76534a590ba08933ff7ea54813316 (patch)
tree35db6003766dff695cf8a5aa24f47629b602b7c0 /gallery_dl/path.py
parent3338dfce719c999467ffe08fd45663be8190057a (diff)
New upstream version 1.24.2.upstream/1.24.2
Diffstat (limited to 'gallery_dl/path.py')
-rw-r--r--gallery_dl/path.py21
1 files changed, 14 insertions, 7 deletions
diff --git a/gallery_dl/path.py b/gallery_dl/path.py
index 7d599ee..3b360e9 100644
--- a/gallery_dl/path.py
+++ b/gallery_dl/path.py
@@ -29,6 +29,8 @@ class PathFormat():
def __init__(self, extractor):
config = extractor.config
kwdefault = config("keywords-default")
+ if kwdefault is None:
+ kwdefault = util.NONE
filename_fmt = config("filename")
try:
@@ -212,14 +214,19 @@ class PathFormat():
def fix_extension(self, _=None):
"""Fix filenames without a given filename extension"""
- if not self.extension:
- self.kwdict["extension"] = self.prefix + self.extension_map("", "")
- self.build_path()
- if self.path[-1] == ".":
- self.path = self.path[:-1]
- self.temppath = self.realpath = self.realpath[:-1]
- elif not self.temppath:
+ try:
+ if not self.extension:
+ self.kwdict["extension"] = \
+ self.prefix + self.extension_map("", "")
+ self.build_path()
+ if self.path[-1] == ".":
+ self.path = self.path[:-1]
+ self.temppath = self.realpath = self.realpath[:-1]
+ elif not self.temppath:
+ self.build_path()
+ except Exception:
self.path = self.directory + "?"
+ self.realpath = self.temppath = self.realdirectory + "?"
return True
def build_filename(self, kwdict):