download-as-zip: option to skip dotfiles

This commit is contained in:
ed 2026-01-01 21:41:11 +00:00
parent 63d8e5a033
commit 7d7a1510fb
3 changed files with 9 additions and 7 deletions

View file

@ -812,6 +812,7 @@ you can also zip a selection of files or folders by clicking them in the browser
cool trick: download a folder by appending url-params `?tar&opus` or `?tar&mp3` to transcode all audio files (except aac|m4a|mp3|ogg|opus|wma) to opus/mp3 before they're added to the archive cool trick: download a folder by appending url-params `?tar&opus` or `?tar&mp3` to transcode all audio files (except aac|m4a|mp3|ogg|opus|wma) to opus/mp3 before they're added to the archive
* super useful if you're 5 minutes away from takeoff and realize you don't have any music on your phone but your server only has flac files and downloading those will burn through all your data + there wouldn't be enough time anyways * super useful if you're 5 minutes away from takeoff and realize you don't have any music on your phone but your server only has flac files and downloading those will burn through all your data + there wouldn't be enough time anyways
* and url-param `&nodot` skips dotfiles/dotfolders; they are included by default if your account has permission to see them
* and url-params `&j` / `&w` produce jpeg/webm thumbnails/spectrograms instead of the original audio/video/images (`&p` for audio waveforms) * and url-params `&j` / `&w` produce jpeg/webm thumbnails/spectrograms instead of the original audio/video/images (`&p` for audio waveforms)
* can also be used to pregenerate thumbnails; combine with `--th-maxage=9999999` or `--th-clean=0` * can also be used to pregenerate thumbnails; combine with `--th-maxage=9999999` or `--th-clean=0`

View file

@ -896,6 +896,7 @@ class VFS(object):
flt: set[str], flt: set[str],
uname: str, uname: str,
dirs: bool, dirs: bool,
dots: int,
scandir: bool, scandir: bool,
wrap: bool = True, wrap: bool = True,
) -> Generator[dict[str, Any], None, None]: ) -> Generator[dict[str, Any], None, None]:
@ -904,7 +905,7 @@ class VFS(object):
# if single folder: the folder itself is the top-level item # if single folder: the folder itself is the top-level item
folder = "" if flt or not wrap else (vpath.split("/")[-1].lstrip(".") or "top") folder = "" if flt or not wrap else (vpath.split("/")[-1].lstrip(".") or "top")
g = self.walk(folder, vrem, [], uname, [[True, False]], 1, scandir, False) g = self.walk(folder, vrem, [], uname, [[True, False]], dots, scandir, False)
for _, _, vpath, apath, files, rd, vd in g: for _, _, vpath, apath, files, rd, vd in g:
if flt: if flt:
files = [x for x in files if x[0] in flt] files = [x for x in files if x[0] in flt]

View file

@ -1779,6 +1779,7 @@ class HttpCli(object):
set(), set(),
self.uname, self.uname,
True, True,
1,
not self.args.no_scandir, not self.args.no_scandir,
wrap=False, wrap=False,
) )
@ -5014,6 +5015,9 @@ class HttpCli(object):
packer = StreamZip packer = StreamZip
ext = "zip" ext = "zip"
dots = 0 if "nodot" in self.uparam else 1
scandir = not self.args.no_scandir
fn = self.vpath.split("/")[-1] or self.host.split(":")[0] fn = self.vpath.split("/")[-1] or self.host.split(":")[0]
if items: if items:
fn = "sel-" + fn fn = "sel-" + fn
@ -5025,9 +5029,7 @@ class HttpCli(object):
maxn = vn.flags.get("zipmaxn_v") or 0 maxn = vn.flags.get("zipmaxn_v") or 0
nf = 0 nf = 0
nb = 0 nb = 0
fgen = vn.zipgen( fgen = vn.zipgen(vpath, rem, set(items), self.uname, False, dots, scandir)
vpath, rem, set(items), self.uname, False, not self.args.no_scandir
)
t = "total size exceeds a limit specified in server config" t = "total size exceeds a limit specified in server config"
t = vn.flags.get("zipmaxt") or t t = vn.flags.get("zipmaxt") or t
if maxs and maxn: if maxs and maxn:
@ -5051,9 +5053,7 @@ class HttpCli(object):
self.log(repr(cdis)) self.log(repr(cdis))
self.send_headers(None, mime=mime, headers={"Content-Disposition": cdis}) self.send_headers(None, mime=mime, headers={"Content-Disposition": cdis})
fgen = vn.zipgen( fgen = vn.zipgen(vpath, rem, set(items), self.uname, False, dots, scandir)
vpath, rem, set(items), self.uname, False, not self.args.no_scandir
)
# for f in fgen: print(repr({k: f[k] for k in ["vp", "ap"]})) # for f in fgen: print(repr({k: f[k] for k in ["vp", "ap"]}))
cfmt = "" cfmt = ""
if self.thumbcli and not self.args.no_bacode: if self.thumbcli and not self.args.no_bacode: