mirror of
https://github.com/Kozea/Radicale.git
synced 2025-08-07 18:30:54 +00:00
Export: Check if export path exists
Prevent ``shutil.move`` from moving to .../root
This commit is contained in:
parent
d069be5189
commit
715a90b33c
1 changed files with 4 additions and 1 deletions
|
@ -130,8 +130,11 @@ def export_storage(config, path, debug=False):
|
|||
traceback.print_exc()
|
||||
exit(1)
|
||||
try:
|
||||
# This check is prone to a race condition
|
||||
if os.path.exists(path):
|
||||
raise Exception("Destination path %r already exists" % path)
|
||||
shutil.move(os.path.join(temp, "root"), path)
|
||||
except (OSError, shutil.Error) as e:
|
||||
except Exception as e:
|
||||
print("ERROR: Can't create %r directory: %s" % (path, e))
|
||||
if debug:
|
||||
traceback.print_exc()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue