diff --git a/owrx/form/input/converter.py b/owrx/form/input/converter.py index ddb2d0e4..75bb2290 100644 --- a/owrx/form/input/converter.py +++ b/owrx/form/input/converter.py @@ -30,14 +30,15 @@ class TextConverter(Converter): Converter class for text inputs Does nothing more than to prevent the special python value "None" from appearing in the form The string "None" should pass + Strips leading and trailing whitespace """ def convert_to_form(self, value): if value is None: return "" - return value + return str(value) def convert_from_form(self, value): - return value + return str(value).strip() class OptionalConverter(Converter): diff --git a/owrx/form/input/validator.py b/owrx/form/input/validator.py index 462ec221..db3417a9 100644 --- a/owrx/form/input/validator.py +++ b/owrx/form/input/validator.py @@ -11,7 +11,7 @@ class Validator(ABC): class RequiredValidator(Validator): def validate(self, key, value) -> None: - if value is None or value == "": + if value is None or value.strip() == "": raise ValidationError(key, "Field is required")