Port final lab 4 validation and session revocation fixes
This commit is contained in:
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user