mirror of
https://github.com/9001/copyparty.git
synced 2025-08-17 00:52:16 -06:00
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
This commit is contained in:
parent
51d31588e6
commit
0287c7baa5
|
@ -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))
|
||||
|
|
Loading…
Reference in a new issue