From 9a146192b74d8ff5d51b370e28c842545f14c306 Mon Sep 17 00:00:00 2001 From: ed Date: Tue, 7 Sep 2021 00:43:51 +0200 Subject: [PATCH] don't unwrap single folders in zip/tar downloads --- copyparty/authsrv.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/copyparty/authsrv.py b/copyparty/authsrv.py index 672d6c58..c58f9f43 100644 --- a/copyparty/authsrv.py +++ b/copyparty/authsrv.py @@ -434,7 +434,11 @@ class VFS(object): f2a = os.sep + "dir.txt" f2b = "{0}.hist{0}".format(os.sep) - g = self.walk("", vrem, [], uname, [[True]], dots, scandir, False) + # if multiselect: add all items to archive root + # if single folder: the folder itself is the top-level item + folder = "" if flt else (vrem.split("/")[-1] or "top") + + g = self.walk(folder, vrem, [], uname, [[True]], dots, scandir, False) for _, _, vpath, apath, files, rd, vd in g: if flt: files = [x for x in files if x[0] in flt]