mirror of
https://github.com/9001/copyparty.git
synced 2025-08-17 17:12:13 -06:00
when rootless, blank instead of block rootdir
This commit is contained in:
parent
acd8149479
commit
4dd5d4e1b7
|
@ -22,7 +22,7 @@ class VFS(object):
|
|||
self.uadm = uadm # users who are regular admins
|
||||
self.flags = flags # config switches
|
||||
self.nodes = {} # child nodes
|
||||
self.all_vols = {vpath: self} # flattened recursive
|
||||
self.all_vols = {vpath: self} if realpath else {} # flattened recursive
|
||||
|
||||
def __repr__(self):
|
||||
return "VFS({})".format(
|
||||
|
@ -430,7 +430,7 @@ class AuthSrv(object):
|
|||
vfs = VFS(os.path.abspath("."), "", ["*"], ["*"])
|
||||
elif "" not in mount:
|
||||
# there's volumes but no root; make root inaccessible
|
||||
vfs = VFS(os.path.abspath("."), "")
|
||||
vfs = VFS(None, "")
|
||||
vfs.flags["d2d"] = True
|
||||
|
||||
maxdepth = 0
|
||||
|
|
|
@ -186,11 +186,13 @@ class Up2k(object):
|
|||
self.log("cannot access " + vol.realpath, c=1)
|
||||
continue
|
||||
|
||||
if scan_vols and vol.vpath not in scan_vols:
|
||||
continue
|
||||
|
||||
if not self.register_vpath(vol.realpath, vol.flags):
|
||||
# self.log("db not enabled for {}".format(m, vol.realpath))
|
||||
continue
|
||||
|
||||
if vol.vpath in scan_vols or not scan_vols:
|
||||
live_vols.append(vol)
|
||||
|
||||
if vol.vpath not in self.volstate:
|
||||
|
@ -288,7 +290,10 @@ class Up2k(object):
|
|||
def register_vpath(self, ptop, flags):
|
||||
db_path = os.path.join(ptop, ".hist", "up2k.db")
|
||||
if ptop in self.registry:
|
||||
try:
|
||||
return [self.cur[ptop], db_path]
|
||||
except:
|
||||
return None
|
||||
|
||||
_, flags = self._expr_idx_filter(flags)
|
||||
|
||||
|
|
|
@ -251,7 +251,7 @@ class TestVFS(unittest.TestCase):
|
|||
n = au.vfs
|
||||
# root was not defined, so PWD with no access to anyone
|
||||
self.assertEqual(n.vpath, "")
|
||||
self.assertEqual(n.realpath, td)
|
||||
self.assertEqual(n.realpath, None)
|
||||
self.assertEqual(n.uread, [])
|
||||
self.assertEqual(n.uwrite, [])
|
||||
self.assertEqual(len(n.nodes), 1)
|
||||
|
|
Loading…
Reference in a new issue