Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions .gitignore

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the change made in this file necessary to fix the bug?

Original file line number Diff line number Diff line change
@@ -1 +1,11 @@
.DS_Store
# Virtual environments
venv/
.venv/
env/
.env/
ENV/

# Python cache files
__pycache__/
*.pyc
5 changes: 4 additions & 1 deletion backend/endpoints.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,10 @@ def send_bloom():
if type_check_error is not None:
return type_check_error

user = get_current_user()
if len(request.json["content"]) > 280:
return make_response((f"Bloom too long", 422))
Comment on lines +159 to +160

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This fixes the bug. well done.

Why not replace the magic number 280 by a named constant?


user = get_current_user()

blooms.add_bloom(sender=user, content=request.json["content"])

Expand Down
1 change: 1 addition & 0 deletions front-end/components/error.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ const _STATUS_MESSAGES = {
404: "Not Found - The requested resource does not exist.",
405: "Not Allowed - The server knows the request method, but the target resource doesn't support this method.",
418: "I'm a teapot - Server refuses to brew coffee with a teapot.",
422: "Something is wrong with the information you filled out. Please check your inputs and try again.",

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the status message associated with 422 a standard status message? How did you come up with this message?

500: "Internal Server Error - Something went wrong on the server.",
};

Expand Down