summaryrefslogtreecommitdiff
path: root/kvmd/validators
diff options
context:
space:
mode:
Diffstat (limited to 'kvmd/validators')
-rw-r--r--kvmd/validators/kvm.py11
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]: