option to list dotfiles

This commit is contained in:
ed 2020-05-16 01:40:29 +02:00
parent 09557fbe83
commit 94ad1f5732
3 changed files with 14 additions and 7 deletions

View file

@ -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))

View file

@ -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()

View file

@ -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: