mirror of
https://github.com/9001/copyparty.git
synced 2025-08-17 17:12:13 -06:00
support propfind of files (not just dirs)
This commit is contained in:
parent
d8142e866a
commit
bb72e6bf30
|
@ -865,7 +865,17 @@ class HttpCli(object):
|
||||||
vn, rem = self.asrv.vfs.get(self.vpath, self.uname, True, False, err=401)
|
vn, rem = self.asrv.vfs.get(self.vpath, self.uname, True, False, err=401)
|
||||||
depth = self.headers.get("depth", "infinity").lower()
|
depth = self.headers.get("depth", "infinity").lower()
|
||||||
|
|
||||||
if depth == "infinity":
|
try:
|
||||||
|
topdir = {"vp": "", "st": bos.stat(vn.canonical(rem))}
|
||||||
|
except OSError as ex:
|
||||||
|
if ex.errno != errno.ENOENT:
|
||||||
|
raise
|
||||||
|
raise Pebkac(404)
|
||||||
|
|
||||||
|
if not stat.S_ISDIR(topdir["st"].st_mode):
|
||||||
|
fgen = []
|
||||||
|
|
||||||
|
elif depth == "infinity":
|
||||||
if not self.args.dav_inf:
|
if not self.args.dav_inf:
|
||||||
self.log("client wants --dav-inf", 3)
|
self.log("client wants --dav-inf", 3)
|
||||||
zb = b'<?xml version="1.0" encoding="utf-8"?>\n<D:error xmlns:D="DAV:"><D:propfind-finite-depth/></D:error>'
|
zb = b'<?xml version="1.0" encoding="utf-8"?>\n<D:error xmlns:D="DAV:"><D:propfind-finite-depth/></D:error>'
|
||||||
|
@ -904,13 +914,6 @@ class HttpCli(object):
|
||||||
t2 = " or 'infinity'" if self.args.dav_inf else ""
|
t2 = " or 'infinity'" if self.args.dav_inf else ""
|
||||||
raise Pebkac(412, t.format(depth, t2))
|
raise Pebkac(412, t.format(depth, t2))
|
||||||
|
|
||||||
try:
|
|
||||||
topdir = {"vp": "", "st": os.stat(vn.canonical(rem))}
|
|
||||||
except OSError as ex:
|
|
||||||
if ex.errno != errno.ENOENT:
|
|
||||||
raise
|
|
||||||
raise Pebkac(404)
|
|
||||||
|
|
||||||
fgen = itertools.chain([topdir], fgen) # type: ignore
|
fgen = itertools.chain([topdir], fgen) # type: ignore
|
||||||
vtop = vjoin(self.args.R, vjoin(vn.vpath, rem))
|
vtop = vjoin(self.args.R, vjoin(vn.vpath, rem))
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue