From 94ad1f57320155f42c2c5550cf9cabcf1441e634 Mon Sep 17 00:00:00 2001 From: ed Date: Sat, 16 May 2020 01:40:29 +0200 Subject: [PATCH] option to list dotfiles --- bin/copyparty-fuse.py | 4 ++-- copyparty/__main__.py | 3 ++- copyparty/httpcli.py | 14 ++++++++++---- 3 files changed, 14 insertions(+), 7 deletions(-) diff --git a/bin/copyparty-fuse.py b/bin/copyparty-fuse.py index bb8d8cb3..a12b8220 100644 --- a/bin/copyparty-fuse.py +++ b/bin/copyparty-fuse.py @@ -147,7 +147,7 @@ class Gateway(object): return c.getresponse() def listdir(self, path): - web_path = "/" + "/".join([self.web_root, path]) + web_path = "/" + "/".join([self.web_root, path]) + "?dots" r = self.sendreq("GET", self.quotep(web_path)) if r.status != 200: @@ -161,7 +161,7 @@ class Gateway(object): return self.parse_html(r) def download_file_range(self, path, ofs1, ofs2): - web_path = "/" + "/".join([self.web_root, path]) + web_path = "/" + "/".join([self.web_root, path]) + "?raw" hdr_range = "bytes={}-{}".format(ofs1, ofs2 - 1) log("downloading {}".format(hdr_range)) diff --git a/copyparty/__main__.py b/copyparty/__main__.py index 1f33339b..232be022 100644 --- a/copyparty/__main__.py +++ b/copyparty/__main__.py @@ -133,7 +133,8 @@ def main(): ap.add_argument("-a", metavar="ACCT", type=str, action="append", help="add account") ap.add_argument("-v", metavar="VOL", type=str, action="append", help="add volume") ap.add_argument("-q", action="store_true", help="quiet") - ap.add_argument("-nw", action="store_true", help="benchmark: disable writing") + ap.add_argument("-ed", action="store_true", help="enable ?dots") + ap.add_argument("-nw", action="store_true", help="disable writes (benchmark)") al = ap.parse_args() SvcHub(al).run() diff --git a/copyparty/httpcli.py b/copyparty/httpcli.py index 3a9351b3..35bd3428 100644 --- a/copyparty/httpcli.py +++ b/copyparty/httpcli.py @@ -777,9 +777,11 @@ class HttpCli(object): except: err = "invalid range ({}), size={}".format(hrange, file_sz) - self.loud_reply(err, status=416, headers={ - "Content-Range": "bytes */{}".format(file_sz) - }) + self.loud_reply( + err, + status=416, + headers={"Content-Range": "bytes */{}".format(file_sz)}, + ) return True status = 206 @@ -948,9 +950,13 @@ class HttpCli(object): except: pass + # show dotfiles if permitted and requested + if not self.args.ed or "dots" not in self.uparam: + vfs_ls = exclude_dotfiles(vfs_ls) + dirs = [] files = [] - for fn in exclude_dotfiles(vfs_ls): + for fn in vfs_ls: base = "" href = fn if self.absolute_urls and vpath: