mirror of
https://github.com/9001/copyparty.git
synced 2025-08-17 00:52:16 -06:00
fix cosmetic volflag stuff:
* `xz` would show the "unrecognized volflag" warning, but it still applied correctly * removing volflags with `-foo` would also show the warning but it would still get removed correctly * hide `ext_th_d` in the startup volume-listing
This commit is contained in:
parent
19520b2ec9
commit
b190e676b4
|
@ -1389,8 +1389,16 @@ class AuthSrv(object):
|
||||||
name = name.lower()
|
name = name.lower()
|
||||||
|
|
||||||
# volflags are snake_case, but a leading dash is the removal operator
|
# volflags are snake_case, but a leading dash is the removal operator
|
||||||
if name not in flagdescs and "-" in name[1:]:
|
stripped = name.lstrip("-")
|
||||||
name = name[:1] + name[1:].replace("-", "_")
|
zi = len(name) - len(stripped)
|
||||||
|
if zi > 1:
|
||||||
|
t = "WARNING: the config for volume [/%s] specified a volflag with multiple leading hyphens (%s); use one hyphen to remove, or zero hyphens to add a flag. Will now enable flag [%s]"
|
||||||
|
self.log(t % (vpath, name, stripped), 3)
|
||||||
|
name = stripped
|
||||||
|
zi = 0
|
||||||
|
|
||||||
|
if stripped not in flagdescs and "-" in stripped:
|
||||||
|
name = ("-" * zi) + stripped.replace("-", "_")
|
||||||
|
|
||||||
desc = flagdescs.get(name.lstrip("-"), "?").replace("\n", " ")
|
desc = flagdescs.get(name.lstrip("-"), "?").replace("\n", " ")
|
||||||
|
|
||||||
|
@ -1576,6 +1584,11 @@ class AuthSrv(object):
|
||||||
for vol in vfs.all_vols.values():
|
for vol in vfs.all_vols.values():
|
||||||
unknown_flags = set()
|
unknown_flags = set()
|
||||||
for k, v in vol.flags.items():
|
for k, v in vol.flags.items():
|
||||||
|
stripped = k.lstrip("-")
|
||||||
|
if k != stripped and stripped not in vol.flags:
|
||||||
|
t = "WARNING: the config for volume [/%s] tried to remove volflag [%s] by specifying [%s] but that volflag was not already set"
|
||||||
|
self.log(t % (vol.vpath, stripped, k), 3)
|
||||||
|
k = stripped
|
||||||
if k not in flagdescs and k not in k_ign:
|
if k not in flagdescs and k not in k_ign:
|
||||||
unknown_flags.add(k)
|
unknown_flags.add(k)
|
||||||
if unknown_flags:
|
if unknown_flags:
|
||||||
|
|
|
@ -156,7 +156,8 @@ flagcats = {
|
||||||
"daw": "enable full WebDAV write support (dangerous);\nPUT-operations will now \033[1;31mOVERWRITE\033[0;35m existing files",
|
"daw": "enable full WebDAV write support (dangerous);\nPUT-operations will now \033[1;31mOVERWRITE\033[0;35m existing files",
|
||||||
"nosub": "forces all uploads into the top folder of the vfs",
|
"nosub": "forces all uploads into the top folder of the vfs",
|
||||||
"magic": "enables filetype detection for nameless uploads",
|
"magic": "enables filetype detection for nameless uploads",
|
||||||
"gz": "allows server-side gzip of uploads with ?gz (also c,xz)",
|
"gz": "allows server-side gzip compression of uploads with ?gz",
|
||||||
|
"xz": "allows server-side lzma compression of uploads with ?xz",
|
||||||
"pk": "forces server-side compression, optional arg: xz,9",
|
"pk": "forces server-side compression, optional arg: xz,9",
|
||||||
},
|
},
|
||||||
"upload rules": {
|
"upload rules": {
|
||||||
|
|
|
@ -1081,7 +1081,7 @@ class Up2k(object):
|
||||||
ft = "\033[0;32m{}{:.0}"
|
ft = "\033[0;32m{}{:.0}"
|
||||||
ff = "\033[0;35m{}{:.0}"
|
ff = "\033[0;35m{}{:.0}"
|
||||||
fv = "\033[0;36m{}:\033[90m{}"
|
fv = "\033[0;36m{}:\033[90m{}"
|
||||||
zs = "html_head mv_re_r mv_re_t rm_re_r rm_re_t srch_re_dots srch_re_nodot"
|
zs = "ext_th_d html_head mv_re_r mv_re_t rm_re_r rm_re_t srch_re_dots srch_re_nodot"
|
||||||
fx = set(zs.split())
|
fx = set(zs.split())
|
||||||
fd = vf_bmap()
|
fd = vf_bmap()
|
||||||
fd.update(vf_cmap())
|
fd.update(vf_cmap())
|
||||||
|
|
Loading…
Reference in a new issue