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.uadm = uadm # users who are regular admins
|
||||||
self.flags = flags # config switches
|
self.flags = flags # config switches
|
||||||
self.nodes = {} # child nodes
|
self.nodes = {} # child nodes
|
||||||
self.all_vols = {vpath: self} # flattened recursive
|
self.all_vols = {vpath: self} if realpath else {} # flattened recursive
|
||||||
|
|
||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
return "VFS({})".format(
|
return "VFS({})".format(
|
||||||
|
@ -430,7 +430,7 @@ class AuthSrv(object):
|
||||||
vfs = VFS(os.path.abspath("."), "", ["*"], ["*"])
|
vfs = VFS(os.path.abspath("."), "", ["*"], ["*"])
|
||||||
elif "" not in mount:
|
elif "" not in mount:
|
||||||
# there's volumes but no root; make root inaccessible
|
# there's volumes but no root; make root inaccessible
|
||||||
vfs = VFS(os.path.abspath("."), "")
|
vfs = VFS(None, "")
|
||||||
vfs.flags["d2d"] = True
|
vfs.flags["d2d"] = True
|
||||||
|
|
||||||
maxdepth = 0
|
maxdepth = 0
|
||||||
|
|
|
@ -186,12 +186,14 @@ class Up2k(object):
|
||||||
self.log("cannot access " + vol.realpath, c=1)
|
self.log("cannot access " + vol.realpath, c=1)
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
if scan_vols and vol.vpath not in scan_vols:
|
||||||
|
continue
|
||||||
|
|
||||||
if not self.register_vpath(vol.realpath, vol.flags):
|
if not self.register_vpath(vol.realpath, vol.flags):
|
||||||
# self.log("db not enabled for {}".format(m, vol.realpath))
|
# self.log("db not enabled for {}".format(m, vol.realpath))
|
||||||
continue
|
continue
|
||||||
|
|
||||||
if vol.vpath in scan_vols or not scan_vols:
|
live_vols.append(vol)
|
||||||
live_vols.append(vol)
|
|
||||||
|
|
||||||
if vol.vpath not in self.volstate:
|
if vol.vpath not in self.volstate:
|
||||||
self.volstate[vol.vpath] = "OFFLINE (pending initialization)"
|
self.volstate[vol.vpath] = "OFFLINE (pending initialization)"
|
||||||
|
@ -288,7 +290,10 @@ class Up2k(object):
|
||||||
def register_vpath(self, ptop, flags):
|
def register_vpath(self, ptop, flags):
|
||||||
db_path = os.path.join(ptop, ".hist", "up2k.db")
|
db_path = os.path.join(ptop, ".hist", "up2k.db")
|
||||||
if ptop in self.registry:
|
if ptop in self.registry:
|
||||||
return [self.cur[ptop], db_path]
|
try:
|
||||||
|
return [self.cur[ptop], db_path]
|
||||||
|
except:
|
||||||
|
return None
|
||||||
|
|
||||||
_, flags = self._expr_idx_filter(flags)
|
_, flags = self._expr_idx_filter(flags)
|
||||||
|
|
||||||
|
|
|
@ -251,7 +251,7 @@ class TestVFS(unittest.TestCase):
|
||||||
n = au.vfs
|
n = au.vfs
|
||||||
# root was not defined, so PWD with no access to anyone
|
# root was not defined, so PWD with no access to anyone
|
||||||
self.assertEqual(n.vpath, "")
|
self.assertEqual(n.vpath, "")
|
||||||
self.assertEqual(n.realpath, td)
|
self.assertEqual(n.realpath, None)
|
||||||
self.assertEqual(n.uread, [])
|
self.assertEqual(n.uread, [])
|
||||||
self.assertEqual(n.uwrite, [])
|
self.assertEqual(n.uwrite, [])
|
||||||
self.assertEqual(len(n.nodes), 1)
|
self.assertEqual(len(n.nodes), 1)
|
||||||
|
|
Loading…
Reference in a new issue