diff options
author | Maxim Devaev <[email protected]> | 2023-03-06 03:01:12 +0200 |
---|---|---|
committer | Maxim Devaev <[email protected]> | 2023-03-06 03:16:37 +0200 |
commit | 5495f70564e03ae0d6ac81866a37cdd79858d4e4 (patch) | |
tree | 5f72e11179000691bad65ff3d69647ae706e2237 /kvmd/validators | |
parent | c63bb2adb788ed07d12f446ee12bd692004b59d6 (diff) |
msd images tree
Diffstat (limited to 'kvmd/validators')
-rw-r--r-- | kvmd/validators/kvm.py | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/kvmd/validators/kvm.py b/kvmd/validators/kvm.py index a3e5c32d..5ea6ee0b 100644 --- a/kvmd/validators/kvm.py +++ b/kvmd/validators/kvm.py @@ -42,10 +42,15 @@ def valid_atx_button(arg: Any) -> str: def valid_msd_image_name(arg: Any) -> str: name = "MSD image name" - arg = valid_printable_filename(arg, name=name) - if arg.startswith(".__") or arg == "lost+found": + arg = valid_stripped_string_not_empty(arg, name) + parts: list[str] = list(filter(None, arg.split("/"))) + if len(parts) == 0: raise_error(arg, name) - return arg + 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) def valid_info_fields(arg: Any, variants: set[str]) -> set[str]: |