Port final lab 4 validation and session revocation fixes

This commit is contained in:
Artyom
2026-11-06 22:33:31 +03:00
parent f88e9ba43c
commit 0e92111661
47 changed files with 5097 additions and 32 deletions
+4
View File
@@ -15,6 +15,8 @@ class ChatTitle:
def __post_init__(self) -> None:
if not isinstance(self.value, str):
raise InvalidChatData("поле title должно быть строкой")
if "\x00" in self.value:
raise InvalidChatData("поле title не может содержать NUL")
if not self.value.strip():
raise InvalidChatData("поле title не может быть пустым или состоять из пробелов")
if len(self.value) > CHAT_TITLE_MAX:
@@ -31,6 +33,8 @@ class MessageText:
def __post_init__(self) -> None:
if not isinstance(self.value, str):
raise InvalidMessageText("поле text должно быть строкой")
if "\x00" in self.value:
raise InvalidMessageText("поле text не может содержать NUL")
if self.value and not self.value.strip():
raise InvalidMessageText("поле text не может состоять из пробелов")
if len(self.value) > MESSAGE_TEXT_MAX: