diff --git a/backend/endpoints.py b/backend/endpoints.py index 0e177a07..cf769358 100644 --- a/backend/endpoints.py +++ b/backend/endpoints.py @@ -18,6 +18,7 @@ from datetime import timedelta MINIMUM_PASSWORD_LENGTH = 5 +MAXIMUM_BLOOM_LENGTH = 280 def login(): @@ -157,6 +158,13 @@ def send_bloom(): return type_check_error user = get_current_user() + content = request.json(["content"]) + + if (len(content)) > MAXIMUM_BLOOM_LENGTH: + return make_response({ + "success": False, + "message": f"Bloom too long", + }, 400) blooms.add_bloom(sender=user, content=request.json["content"])