summaryrefslogtreecommitdiff
path: root/kvmd/validators/os.py
diff options
context:
space:
mode:
authorMaxim Devaev <[email protected]>2024-07-08 03:41:29 +0300
committerMaxim Devaev <[email protected]>2024-12-17 18:20:04 +0200
commit630610bc532299f15ff7ee12d40f617de450aae0 (patch)
treeca0a83f1aa5848a4605034c0394f1edfd0bea7ce /kvmd/validators/os.py
parente0bbf6968ef8295274793a564e717f95f42983d7 (diff)
switch
Diffstat (limited to 'kvmd/validators/os.py')
-rw-r--r--kvmd/validators/os.py10
1 files changed, 2 insertions, 8 deletions
diff --git a/kvmd/validators/os.py b/kvmd/validators/os.py
index 94d3a40f..b2381d0b 100644
--- a/kvmd/validators/os.py
+++ b/kvmd/validators/os.py
@@ -26,6 +26,7 @@ import stat
from typing import Any
from . import raise_error
+from . import filter_printable
from .basic import valid_number
from .basic import valid_string_list
@@ -75,9 +76,7 @@ def valid_abs_dir(arg: Any, name: str="") -> str:
def valid_printable_filename(arg: Any, name: str="") -> str:
if not name:
name = "printable filename"
-
arg = valid_stripped_string_not_empty(arg, name)
-
if (
"/" in arg
or "\0" in arg
@@ -85,12 +84,7 @@ def valid_printable_filename(arg: Any, name: str="") -> str:
or arg == "lost+found"
):
raise_error(arg, name)
-
- arg = "".join(
- (ch if ch.isprintable() else "_")
- for ch in arg[:255]
- )
- return arg
+ return filter_printable(arg, "_", 255)
# =====