personalization.ConfigurableParameter: fix BytesIO() input

Change-Id: I0ad160eef9015e76eef10baee7c6b606fe249123
This commit is contained in:
Neels Hofmeyr committed 2025-12-13 22:34:23 +01:00
1 parent 58aafe36c7
commit 6b68e7b54d
3 files changed
+193

No files matched your search

+3
View File
@@ -198,6 +198,9 @@ class ConfigurableParameter:
if cls.allow_chars is not None:
if any(c not in cls.allow_chars for c in val):
raise ValueError(f"invalid characters in input value {val!r}, valid chars are {cls.allow_chars}")
elif isinstance(val, io.BytesIO):
val = val.getvalue()
if cls.allow_len is not None:
l = cls.allow_len
# cls.allow_len could be one int, or a tuple of ints. Wrap a single int also in a tuple.