d2d should disable search/unpost even if db exists

This commit is contained in:
ed 2024-04-22 18:55:13 +00:00
parent 70a3cf36d1
commit 95d9e693c6
4 changed files with 11 additions and 7 deletions

View file

@ -3867,7 +3867,7 @@ class HttpCli(object):
allvols = [x for x in allvols if "e2d" in x.flags]
for vol in allvols:
cur = idx.get_cur(vol.realpath)
cur = idx.get_cur(vol)
if not cur:
continue
@ -4093,7 +4093,7 @@ class HttpCli(object):
if is_dir and (e2t or e2d):
idx = self.conn.get_u2idx()
if idx and hasattr(idx, "p_end"):
icur = idx.get_cur(dbv.realpath)
icur = idx.get_cur(dbv)
th_fmt = self.uparam.get("th")
if self.can_read or (self.can_get and vn.flags.get("dk")):

View file

@ -179,7 +179,7 @@ class Metrics(object):
tnbytes = 0
tnfiles = 0
for vpath, vol in allvols:
cur = idx.get_cur(vol.realpath)
cur = idx.get_cur(vol)
if not cur:
continue

View file

@ -81,14 +81,18 @@ class U2idx(object):
except:
raise Pebkac(500, min_ex())
def get_cur(self, ptop: str) -> Optional["sqlite3.Cursor"]:
def get_cur(self, vn: VFS) -> Optional["sqlite3.Cursor"]:
if not HAVE_SQLITE3:
return None
cur = self.cur.get(ptop)
cur = self.cur.get(vn.realpath)
if cur:
return cur
if "e2d" not in vn.flags:
return None
ptop = vn.realpath
histpath = self.asrv.vfs.histtab.get(ptop)
if not histpath:
self.log("no histpath for [{}]".format(ptop))
@ -317,7 +321,7 @@ class U2idx(object):
ptop = vol.realpath
flags = vol.flags
cur = self.get_cur(ptop)
cur = self.get_cur(vol)
if not cur:
continue

View file

@ -80,7 +80,7 @@ class TestHttpCli(unittest.TestCase):
x = " ".join(sorted([x["rp"] for x in x[0]]))
self.assertEqual(x, ".f0 .t/.f2 .t/f2 a/da/f4 a/f3 f0 t/.f1 t/f1")
self.args = Cfg(v=vcfg, a=["u1:u1", "u2:u2"], dotsrch=False)
self.args = Cfg(v=vcfg, a=["u1:u1", "u2:u2"], dotsrch=False, e2d=True)
self.asrv = AuthSrv(self.args, self.log)
u2idx = U2idx(self)