Skip to content

Commit

Permalink
Merge pull request #62 from ncw/fix-rclone-create
Browse files Browse the repository at this point in the history
rclone backend: don't error on create if source directory is empty
  • Loading branch information
ThomasWaldmann authored Sep 27, 2024
2 parents 2b21596 + 2ff6289 commit 5465678
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/borgstore/backends/rclone.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,9 +169,11 @@ def create(self):
if self.process:
raise BackendMustNotBeOpen()
with self:
info = self.info("")
if info.exists:
raise BackendAlreadyExists(f"rclone storage base path already exists: {self.fs}")
try:
if any(self.list("")):
raise BackendAlreadyExists(f"rclone storage base path exists and isn't empty: {self.fs}")
except ObjectNotFound:
pass
self.mkdir("")

def destroy(self):
Expand Down

0 comments on commit 5465678

Please sign in to comment.