diff options
author | Maxim Devaev <[email protected]> | 2023-03-06 04:18:38 +0200 |
---|---|---|
committer | Maxim Devaev <[email protected]> | 2023-03-06 04:18:38 +0200 |
commit | 7667834b6de23ce71ea2e805f6a50eb679444b9e (patch) | |
tree | fac801c7d5372d0c7e4c218393d823a3a4cf9954 /kvmd/validators | |
parent | 5495f70564e03ae0d6ac81866a37cdd79858d4e4 (diff) |
structly validation
Diffstat (limited to 'kvmd/validators')
-rw-r--r-- | kvmd/validators/kvm.py | 2 | ||||
-rw-r--r-- | kvmd/validators/os.py | 7 |
2 files changed, 6 insertions, 3 deletions
diff --git a/kvmd/validators/kvm.py b/kvmd/validators/kvm.py index 5ea6ee0b..32939af7 100644 --- a/kvmd/validators/kvm.py +++ b/kvmd/validators/kvm.py @@ -48,8 +48,6 @@ def valid_msd_image_name(arg: Any) -> str: raise_error(arg, name) for (index, part) in enumerate(list(parts)): parts[index] = valid_printable_filename(part, name=name) - if part.startswith(".__") or part == "lost+found": - raise_error(part, name) return "/".join(parts) diff --git a/kvmd/validators/os.py b/kvmd/validators/os.py index 97aabdf0..702984c5 100644 --- a/kvmd/validators/os.py +++ b/kvmd/validators/os.py @@ -78,7 +78,12 @@ def valid_printable_filename(arg: Any, name: str="") -> str: arg = valid_stripped_string_not_empty(arg, name) - if "/" in arg or "\0" in arg or arg in [".", ".."]: + if ( + "/" in arg + or "\0" in arg + or arg.startswith(".") + or arg == "lost+found" + ): raise_error(arg, name) arg = "".join( |