mirror of
https://github.com/9001/copyparty.git
synced 2026-10-06 08:44:35 +01:00
allow dk download-as-zip
This commit is contained in:
+13
-3
@@ -7416,10 +7416,10 @@ class HttpCli(object):
|
|||||||
for k in ["zip", "tar"]:
|
for k in ["zip", "tar"]:
|
||||||
v = self.uparam.get(k)
|
v = self.uparam.get(k)
|
||||||
if v is not None and (not add_og or not og_fn):
|
if v is not None and (not add_og or not og_fn):
|
||||||
|
filt = []
|
||||||
if is_dk and "dks" not in vn.flags:
|
if is_dk and "dks" not in vn.flags:
|
||||||
t = "server config does not allow download-as-zip/tar; only dk is specified, need dks too"
|
filt = set(vn_ls_regfile(self.args, vn, rem))
|
||||||
raise Pebkac(403, t)
|
return self.tx_zip(k, v, self.vpath, vn, rem, filt)
|
||||||
return self.tx_zip(k, v, self.vpath, vn, rem, [])
|
|
||||||
|
|
||||||
fsroot, vfs_ls, vfs_virt = vn.ls(
|
fsroot, vfs_ls, vfs_virt = vn.ls(
|
||||||
rem,
|
rem,
|
||||||
@@ -8069,3 +8069,13 @@ class HttpCli(object):
|
|||||||
html = self.j2s(tpl, **j2a)
|
html = self.j2s(tpl, **j2a)
|
||||||
self.reply(html.encode("utf-8", "replace"))
|
self.reply(html.encode("utf-8", "replace"))
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
|
def vn_ls_regfile(args: argparse.Namespace, vn: VFS, rem: str) -> list[str]:
|
||||||
|
_, ls, _ = vn.ls(
|
||||||
|
rem,
|
||||||
|
"",
|
||||||
|
not args.no_scandir,
|
||||||
|
[[False, False]],
|
||||||
|
)
|
||||||
|
return [x[0] for x in ls if stat.S_ISREG(x[1].st_mode)]
|
||||||
|
|||||||
Reference in New Issue
Block a user