From a62f744a187bc9f821b540e8bb4e0b9a67bd01c8 Mon Sep 17 00:00:00 2001 From: ed Date: Fri, 22 Sep 2023 23:05:07 +0000 Subject: [PATCH] prevent losing an out-of-volume index if the server is started while an external drive is not mounted, it would drop the database because all the files are missing --- copyparty/up2k.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/copyparty/up2k.py b/copyparty/up2k.py index 56d3fe19..5cceceda 100644 --- a/copyparty/up2k.py +++ b/copyparty/up2k.py @@ -952,6 +952,11 @@ class Up2k(object): 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,