mirror of
https://github.com/9001/copyparty.git
synced 2025-08-17 09:02:15 -06:00
ftpd: only mention vols that user can access
if an ftp client tried to list the toplevel folder on a server where nothing is mounted toplevel, it would syntheisze a directory listing which included all volumes, even those which the user would not be able to access so basically not a problem, just very confusing
This commit is contained in:
parent
6e58514b84
commit
84e8e1ddfb
|
@ -307,9 +307,20 @@ class FtpFs(AbstractedFS):
|
|||
# display write-only folders as empty
|
||||
return []
|
||||
|
||||
# return list of volumes
|
||||
r = {x.split("/")[0]: 1 for x in self.hub.asrv.vfs.all_vols.keys()}
|
||||
return list(sorted(list(r.keys())))
|
||||
# return list of accessible volumes
|
||||
ret = []
|
||||
for vn in self.hub.asrv.vfs.all_vols.values():
|
||||
if "/" in vn.vpath or not vn.vpath:
|
||||
continue # only include toplevel-mounted vols
|
||||
|
||||
try:
|
||||
self.hub.asrv.vfs.get(vn.vpath, self.uname, True, False)
|
||||
ret.append(vn.vpath)
|
||||
except:
|
||||
pass
|
||||
|
||||
ret.sort()
|
||||
return ret
|
||||
|
||||
def rmdir(self, path: str) -> None:
|
||||
ap = self.rv2a(path, d=True)[0]
|
||||
|
|
Loading…
Reference in a new issue