Skip to content

Commit

Permalink
prevent losing an out-of-volume index
Browse files Browse the repository at this point in the history
if the server is started while an external drive is not mounted,
it would drop the database because all the files are missing
  • Loading branch information
9001 committed Sep 22, 2023
1 parent 163e3fc commit a62f744
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions copyparty/up2k.py
Original file line number Diff line number Diff line change
Expand Up @@ -952,6 +952,11 @@ def _build_file_index(self, vol: VFS, all_vols: list[VFS]) -> tuple[bool, bool]:
rtop = absreal(top)
n_add = n_rm = 0
try:
if not bos.listdir(rtop):
t = "volume /%s at [%s] is empty; will not be indexed as this could be due to an offline filesystem"
self.log(t % (vol.vpath, rtop), 6)
return True, False

n_add = self._build_dir(
db,
top,
Expand Down

0 comments on commit a62f744

Please sign in to comment.