Skip to content

Birmingham | 2026-MAR-SDC | Joy Opachavalit | Sprint 1 | Extra long blooms#201

Open
enjoy15 wants to merge 3 commits into
CodeYourFuture:mainfrom
enjoy15:extra-long-blooms
Open

Birmingham | 2026-MAR-SDC | Joy Opachavalit | Sprint 1 | Extra long blooms#201
enjoy15 wants to merge 3 commits into
CodeYourFuture:mainfrom
enjoy15:extra-long-blooms

Conversation

@enjoy15

@enjoy15 enjoy15 commented Jun 9, 2026

Copy link
Copy Markdown

Learners, PR Template

Self checklist

  • I have titled my PR with Region | Cohort | FirstName LastName | Sprint | Assignment Title
  • My changes meet the requirements of the task
  • I have tested my changes
  • My changes follow the style guide

Changelist

Problem

Blooms are enforced to be limited to 280 characters on the frontend, but this constraint was only enforced client-side via HTML5 maxlength attribute. Users can bypass the frontend and post blooms directly to the API with content exceeding 280 characters.

Root Cause

The send_bloom() endpoint in endpoints.py accepts bloom content without validating length before saving to the database. There was no server-side validation.

Solution

Added server-side validation in the send_bloom() endpoint to:

  • Check bloom content length before processing
  • Return a 400 Bad Request error if content exceeds 280 characters
  • Reject and log the violation with a clear error message

Changes Made

File: endpoints.py

  • Modified send_bloom() function to validate content length
  • Returns error response with message: "Bloom content must be 280 characters or less"
  • Validation happens before database insert, preventing invalid data from being stored

@enjoy15 enjoy15 added 📅 Sprint 1 Assigned during Sprint 1 of this module Module-Legacy-Code The name of the module. Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. labels Jun 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Module-Legacy-Code The name of the module. Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. 📅 Sprint 1 Assigned during Sprint 1 of this module

Projects

Status: Backlog

Development

Successfully merging this pull request may close these issues.

1 participant