mirror of
https://github.com/StuffAnThings/qbit_manage.git
synced 2025-12-11 06:17:09 +08:00
bug fix: empty recyclebin dir causing error
This commit is contained in:
parent
a4fbf2a582
commit
8d6fb140b9
2 changed files with 3 additions and 3 deletions
|
|
@ -200,7 +200,7 @@ class Config:
|
|||
else:
|
||||
self.cross_seed_dir = self.util.check_for_attribute(self.data, "cross_seed", parent="directory", default_is_none=True)
|
||||
if self.recyclebin['enabled']:
|
||||
if "recycle_bin" in self.data["directory"]:
|
||||
if "recycle_bin" in self.data["directory"] and self.data["directory"]["recycle_bin"] is not None:
|
||||
default_recycle = os.path.join(self.remote_dir, os.path.basename(self.data['directory']['recycle_bin'].rstrip('/')))
|
||||
else:
|
||||
default_recycle = os.path.join(self.remote_dir, '.RecycleBin')
|
||||
|
|
|
|||
|
|
@ -59,7 +59,7 @@ class check:
|
|||
else:
|
||||
text = f"{parent} sub-attribute {attribute}"
|
||||
|
||||
if data is None or attribute not in data:
|
||||
if data is None or attribute not in data or (attribute in data and data[attribute] is None and not default_is_none):
|
||||
message = f"{text} not found"
|
||||
if parent and save is True:
|
||||
loaded_config, _, _ = yaml.util.load_yaml_guess_indent(open(self.config.config_path))
|
||||
|
|
@ -77,7 +77,7 @@ class check:
|
|||
endline = f"\n{parent} sub-attribute {attribute} added to config"
|
||||
if parent not in loaded_config or not loaded_config[parent]:
|
||||
loaded_config[parent] = {attribute: default}
|
||||
elif attribute not in loaded_config[parent]:
|
||||
elif attribute not in loaded_config[parent] or (attribute in loaded_config[parent] and loaded_config[parent][attribute] is None):
|
||||
loaded_config[parent][attribute] = default
|
||||
else:
|
||||
endline = ""
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue