mirror of
https://github.com/9001/copyparty.git
synced 2025-09-30 13:42:27 -06:00
/?ls on unmapped root
This commit is contained in:
parent
260da2f45c
commit
8f6194fe77
|
@ -1274,7 +1274,7 @@ class HttpCli(object):
|
||||||
if not self.can_read and not self.can_write and not self.can_get:
|
if not self.can_read and not self.can_write and not self.can_get:
|
||||||
t = "@%s has no access to %r"
|
t = "@%s has no access to %r"
|
||||||
|
|
||||||
if "on403" in self.vn.flags:
|
if self.vn.realpath and "on403" in self.vn.flags:
|
||||||
t += " (on403)"
|
t += " (on403)"
|
||||||
self.log(t % (self.uname, "/" + self.vpath))
|
self.log(t % (self.uname, "/" + self.vpath))
|
||||||
ret = self.on40x(self.vn.flags["on403"], self.vn, self.rem)
|
ret = self.on40x(self.vn.flags["on403"], self.vn, self.rem)
|
||||||
|
@ -1308,6 +1308,9 @@ class HttpCli(object):
|
||||||
self.reply(html.encode("utf-8", "replace"), 500)
|
self.reply(html.encode("utf-8", "replace"), 500)
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
if "ls" in self.uparam:
|
||||||
|
return self.tx_ls_vols()
|
||||||
|
|
||||||
if self.vpath:
|
if self.vpath:
|
||||||
ptn = self.args.nonsus_urls
|
ptn = self.args.nonsus_urls
|
||||||
if not ptn or not ptn.search(self.vpath):
|
if not ptn or not ptn.search(self.vpath):
|
||||||
|
@ -6116,6 +6119,47 @@ class HttpCli(object):
|
||||||
self.loud_reply("aborting", status=200)
|
self.loud_reply("aborting", status=200)
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
def tx_ls_vols(self) -> bool:
|
||||||
|
e_d = {}
|
||||||
|
eses = ["", ""]
|
||||||
|
rvol = self.rvol
|
||||||
|
wvol = self.wvol
|
||||||
|
if self.args.have_unlistc:
|
||||||
|
allvols = self.asrv.vfs.all_vols
|
||||||
|
rvol = [x for x in rvol if "unlistcr" not in allvols[x[1:-1]].flags]
|
||||||
|
wvol = [x for x in wvol if "unlistcw" not in allvols[x[1:-1]].flags]
|
||||||
|
vols = list(set(rvol + wvol))
|
||||||
|
if self.vpath:
|
||||||
|
zs = "%s/" % (self.vpath,)
|
||||||
|
vols = [x[len(zs) :] for x in vols if x.startswith(zs)]
|
||||||
|
vols = [x.split("/", 1)[0] for x in vols if x]
|
||||||
|
if not vols and self.vpath:
|
||||||
|
return self.tx_404(True)
|
||||||
|
dirs = [
|
||||||
|
{
|
||||||
|
"lead": "",
|
||||||
|
"href": "%s/" % (x,),
|
||||||
|
"ext": "---",
|
||||||
|
"sz": 0,
|
||||||
|
"ts": 0,
|
||||||
|
"tags": e_d,
|
||||||
|
"dt": 0,
|
||||||
|
"name": 0,
|
||||||
|
}
|
||||||
|
for x in sorted(vols)
|
||||||
|
]
|
||||||
|
ls = {
|
||||||
|
"dirs": dirs,
|
||||||
|
"files": [],
|
||||||
|
"acct": self.uname,
|
||||||
|
"perms": [],
|
||||||
|
"taglist": [],
|
||||||
|
"logues": eses,
|
||||||
|
"readmes": eses,
|
||||||
|
"srvinf": "" if self.args.nih else self.args.name,
|
||||||
|
}
|
||||||
|
return self.tx_ls(ls)
|
||||||
|
|
||||||
def tx_ls(self, ls: dict[str, Any]) -> bool:
|
def tx_ls(self, ls: dict[str, Any]) -> bool:
|
||||||
dirs = ls["dirs"]
|
dirs = ls["dirs"]
|
||||||
files = ls["files"]
|
files = ls["files"]
|
||||||
|
|
Loading…
Reference in a new issue