From 4ec080ec217177821bbec06b9e1ca996984ddbec Mon Sep 17 00:00:00 2001 From: michalpokusa <72110769+michalpokusa@users.noreply.github.com> Date: Fri, 1 Sep 2023 05:36:08 +0000 Subject: [PATCH] Fix #69: `'None'` instead of `None` in FormData.get() --- adafruit_httpserver/interfaces.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/adafruit_httpserver/interfaces.py b/adafruit_httpserver/interfaces.py index d6182e9..48b4e46 100644 --- a/adafruit_httpserver/interfaces.py +++ b/adafruit_httpserver/interfaces.py @@ -65,8 +65,11 @@ def __repr__(self) -> str: return f"{self.__class__.__name__}({repr(self._storage)})" -def _encode_html_entities(value: str) -> str: +def _encode_html_entities(value: Union[str, None]) -> Union[str, None]: """Encodes unsafe HTML characters that could enable XSS attacks.""" + if value is None: + return None + return ( str(value) .replace("&", "&")