mirror of
https://github.com/StuffAnThings/qbit_manage.git
synced 2025-12-10 13:56:13 +08:00
Better error handling for #982
This commit is contained in:
parent
946e653717
commit
94efd542ac
3 changed files with 16 additions and 9 deletions
2
VERSION
2
VERSION
|
|
@ -1 +1 @@
|
|||
4.6.5-develop4
|
||||
4.6.5-develop5
|
||||
|
|
|
|||
|
|
@ -871,15 +871,16 @@ class Config:
|
|||
"""
|
||||
# Assign directories
|
||||
if "directory" in self.data:
|
||||
self.root_dir = os.path.join(
|
||||
self.util.check_for_attribute(self.data, "root_dir", parent="directory", default_is_none=True), ""
|
||||
)
|
||||
self.remote_dir = os.path.join(
|
||||
self.util.check_for_attribute(
|
||||
self.data, "remote_dir", parent="directory", default=self.root_dir, do_print=False, save=False
|
||||
),
|
||||
"",
|
||||
root_dir = self.util.check_for_attribute(self.data, "root_dir", parent="directory", default_is_none=True)
|
||||
if isinstance(root_dir, list):
|
||||
root_dir = root_dir[0]
|
||||
self.root_dir = os.path.join(root_dir, "")
|
||||
remote_dir = self.util.check_for_attribute(
|
||||
self.data, "remote_dir", parent="directory", default=self.root_dir, do_print=False, save=False
|
||||
)
|
||||
if isinstance(remote_dir, list):
|
||||
remote_dir = remote_dir[0]
|
||||
self.remote_dir = os.path.join(remote_dir, "")
|
||||
if self.commands["tag_nohardlinks"] or self.commands["rem_orphaned"]:
|
||||
self.remote_dir = self.util.check_for_attribute(
|
||||
self.data,
|
||||
|
|
|
|||
|
|
@ -1390,6 +1390,12 @@ def path_replace(path, old_path, new_path):
|
|||
return path
|
||||
|
||||
# Normalize all paths to use forward slashes for comparison
|
||||
if isinstance(path, list):
|
||||
path = path[0]
|
||||
if isinstance(old_path, list):
|
||||
old_path = old_path[0]
|
||||
if isinstance(new_path, list):
|
||||
new_path = new_path[0]
|
||||
path_norm = path.replace("\\", "/")
|
||||
old_norm = old_path.replace("\\", "/")
|
||||
new_norm = new_path.replace("\\", "/") if new_path else ""
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue