diff --git a/copyparty/__main__.py b/copyparty/__main__.py index 2e8cfa35..e84790a4 100644 --- a/copyparty/__main__.py +++ b/copyparty/__main__.py @@ -1237,7 +1237,7 @@ def add_optouts(ap): ap2.add_argument("-nid", action="store_true", help="no info disk-usage -- don't show in UI") ap2.add_argument("-nb", action="store_true", help="no powered-by-copyparty branding in UI") ap2.add_argument("--zipmaxn", metavar="N", type=u, default="0", help="reject download-as-zip if more than \033[33mN\033[0m files in total; optionally takes a unit suffix: [\033[32m256\033[0m], [\033[32m9K\033[0m], [\033[32m4G\033[0m] (volflag=zipmaxn)") - ap2.add_argument("--zipmaxs", metavar="MiB", type=u, default="0", help="reject download-as-zip if total download size exceeds \033[33mMiB\033[0m; assumes megabytes unless a unit suffix is given: [\033[32m256\033[0m], [\033[32m4G\033[0m], [\033[32m2T\033[0m] (volflag=zipmaxs)") + ap2.add_argument("--zipmaxs", metavar="SZ", type=u, default="0", help="reject download-as-zip if total download size exceeds \033[33mSZ\033[0m bytes; optionally takes a unit suffix: [\033[32m256M\033[0m], [\033[32m4G\033[0m], [\033[32m2T\033[0m] (volflag=zipmaxs)") ap2.add_argument("--zipmaxt", metavar="TXT", type=u, default="", help="custom errormessage when download size exceeds max (volflag=zipmaxt)") ap2.add_argument("--zipmaxu", action="store_true", help="authenticated users bypass the zip size limit (volflag=zipmaxu)") ap2.add_argument("--zip-who", metavar="LVL", type=int, default=3, help="who can download as zip/tar? [\033[32m0\033[0m]=nobody, [\033[32m1\033[0m]=admins, [\033[32m2\033[0m]=authenticated-with-read-access, [\033[32m3\033[0m]=everyone-with-read-access (volflag=zip_who)\n\033[1;31mWARNING:\033[0m if a nested volume has a more restrictive value than a parent volume, then this will be \033[33mignored\033[0m if the download is initiated from the parent, more lenient volume") diff --git a/copyparty/authsrv.py b/copyparty/authsrv.py index 377a65dc..ead013a8 100644 --- a/copyparty/authsrv.py +++ b/copyparty/authsrv.py @@ -1805,7 +1805,7 @@ class AuthSrv(object): for vol in vfs.all_vols.values(): use = False - for k, si in [["zipmaxn", ""], ["zipmaxs", "m"]]: + for k in ["zipmaxn", "zipmaxs"]: try: zs = vol.flags[k] except: @@ -1814,13 +1814,8 @@ class AuthSrv(object): vol.flags[k] = 0 continue - try: - _ = float(zs) - zs = "%s%s" % (zs, si) - except: - pass zf = unhumanize(zs) - vol.flags[k] = zf + vol.flags[k + "_v"] = zf if zf: use = True if use: diff --git a/copyparty/cfg.py b/copyparty/cfg.py index ab5f30dc..1289ff82 100644 --- a/copyparty/cfg.py +++ b/copyparty/cfg.py @@ -102,6 +102,8 @@ def vf_vmap() -> dict[str, str]: "u2ts", "ups_who", "zip_who", + "zipmaxn", + "zipmaxs", "zipmaxt", ): ret[k] = k diff --git a/copyparty/httpcli.py b/copyparty/httpcli.py index 067552c9..356fdc36 100644 --- a/copyparty/httpcli.py +++ b/copyparty/httpcli.py @@ -4367,8 +4367,8 @@ class HttpCli(object): fn = self.host.split(":")[0] if vn.flags.get("zipmax") and (not self.uname or not "zipmaxu" in vn.flags): - maxs = vn.flags.get("zipmaxs") or 0 - maxn = vn.flags.get("zipmaxn") or 0 + maxs = vn.flags.get("zipmaxs_v") or 0 + maxn = vn.flags.get("zipmaxn_v") or 0 nf = 0 nb = 0 fgen = vn.zipgen( diff --git a/copyparty/up2k.py b/copyparty/up2k.py index b7bb9252..1318777d 100644 --- a/copyparty/up2k.py +++ b/copyparty/up2k.py @@ -1119,7 +1119,7 @@ class Up2k(object): ft = "\033[0;32m{}{:.0}" ff = "\033[0;35m{}{:.0}" fv = "\033[0;36m{}:\033[90m{}" - zs = "ext_th_d html_head mv_re_r mv_re_t rm_re_r rm_re_t srch_re_dots srch_re_nodot zipmax" + zs = "ext_th_d html_head mv_re_r mv_re_t rm_re_r rm_re_t srch_re_dots srch_re_nodot zipmax zipmaxn_v zipmaxs_v" fx = set(zs.split()) fd = vf_bmap() fd.update(vf_cmap())