From 0287c7baa5481e246ae091f08b92450fd8c76cc0 Mon Sep 17 00:00:00 2001 From: ed Date: Mon, 18 Mar 2024 06:15:32 +0100 Subject: [PATCH] fix unpost when there is no rootfs; the volflags of `/` were used to determine if e2d was enabled, which is wrong in two ways: * if there is no `/` volume, it would be globally disabled * if `/` has e2d, but another volume doesn't, it would erroneously think unpost was available, which is not an issue unless that volume used to have e2d enabled AND there is stale data matching the client's IP 3f05b665 (v1.11.0) had an incomplete fix for the stale-data part of the above, which also introduced the other issue --- copyparty/httpcli.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/copyparty/httpcli.py b/copyparty/httpcli.py index 0d8391a4..28fd234b 100644 --- a/copyparty/httpcli.py +++ b/copyparty/httpcli.py @@ -3605,8 +3605,6 @@ class HttpCli(object): return ret def tx_ups(self) -> bool: - have_unpost = self.args.unpost and "e2d" in self.vn.flags - idx = self.conn.get_u2idx() if not idx or not hasattr(idx, "p_end"): raise Pebkac(500, "sqlite3 is not available on the server; cannot unpost") @@ -3630,8 +3628,14 @@ class HttpCli(object): ) uret = x.get() - allvols = self.asrv.vfs.all_vols if have_unpost else {} - for vol in allvols.values(): + if not self.args.unpost: + allvols = [] + else: + allvols = list(self.asrv.vfs.all_vols.values()) + + allvols = [x for x in allvols if "e2d" in x.flags] + + for vol in allvols: cur = idx.get_cur(vol.realpath) if not cur: continue @@ -3683,7 +3687,7 @@ class HttpCli(object): for v in ret: v["vp"] = self.args.SR + v["vp"] - if not have_unpost: + if not allvols: ret = [{"kinshi": 1}] jtxt = '{"u":%s,"c":%s}' % (uret, json.dumps(ret, indent=0))