Skip to content

fix(streak): return SVG instead of JSON on validation error#5227

Merged
JhaSourav07 merged 11 commits into
JhaSourav07:mainfrom
jatingow:fix/streak-api-svg-validation-error
Jun 14, 2026
Merged

fix(streak): return SVG instead of JSON on validation error#5227
JhaSourav07 merged 11 commits into
JhaSourav07:mainfrom
jatingow:fix/streak-api-svg-validation-error

Conversation

@jatingow

Copy link
Copy Markdown
Contributor

Description

When the /api/streak endpoint receives invalid query parameters (e.g. a malformed ?user= value that fails streakParamsSchema.safeParse), it returns a JSON response with Content-Type: application/json and status 400 instead of an SVG image.

Fixes #5183

Pillar

  • 🎨 Pillar 1 — New Theme Design
  • 📐 Pillar 2 — Geometric SVG Improvement
  • 🕐 Pillar 3 — Timezone Logic Optimization
  • 🛠️ Other (Bug fix, refactoring, docs)

Visual Preview

{2F2F81CA-342B-496E-94E9-597558532248}

Checklist before requesting a review:

  • I have read the CONTRIBUTING.md file.
  • I have tested these changes locally (localhost:3000/api/streak?user=YOUR_USERNAME).
  • I have run npm run format and npm run lint locally and resolved all errors (CI will fail otherwise).
  • My commits follow the Conventional Commits format (e.g., feat(themes): ..., fix(calculate): ...).
  • I have updated README.md if I added a new theme or URL parameter.
  • I have started the repo.
  • I have made sure that i have only one commit to merge in this PR.
  • The SVG output matches the CommitPulse "premium quality" aesthetic standard (no raw elements, smooth animations, correct fonts).
  • (Recommended) I joined the CommitPulse Discord community for contributor discussions, mentorship, and faster PR support.

@vercel

vercel Bot commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

@jatingow is attempting to deploy a commit to the jhasourav07's projects Team on Vercel.

A member of the Team first needs to authorize it.

@github-actions github-actions Bot added the status:blocked This PR is blocked due to a failing CI check. label Jun 11, 2026

@Aamod-Dev Aamod-Dev left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Appreciate you taking the time to submit this PR. I went through the implementation and the approach looks solid.

I'm happy to approve this. Great job!

@Aamod-Dev Aamod-Dev added mentor:Aamod007 level:intermediate Moderate complexity tasks quality:clean PR follows clean coding practices, proper formatting, documentation, and maintainability standards. type:bug Something isn't working as expected labels Jun 12, 2026

@Aamod-Dev Aamod-Dev left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thanks for the contribution. I went through the changes and everything looks solid. The code is readable, well-structured, and aligns with the project conventions.

I'll go ahead and approve this PR. Thanks again for the contribution!

@Aamod-Dev Aamod-Dev left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This PR is currently marked with the \status:blocked\ label. Please resolve the blockers so we can proceed with a full review and approval.

@Aamod-Dev Aamod-Dev added GSSoC 2026 level:advanced Complex contributions involving architecture, optimization, or significant feature work quality:clean PR follows clean coding practices, proper formatting, documentation, and maintainability standards. and removed level:intermediate Moderate complexity tasks quality:clean PR follows clean coding practices, proper formatting, documentation, and maintainability standards. labels Jun 13, 2026

@Aamod-Dev Aamod-Dev left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thanks for the contribution! I went through the changes and have evaluated them according to the rubric.

@jatingow jatingow force-pushed the fix/streak-api-svg-validation-error branch from 8fd9668 to e076390 Compare June 13, 2026 12:33
@github-actions github-actions Bot removed the status:blocked This PR is blocked due to a failing CI check. label Jun 13, 2026
@github-actions

Copy link
Copy Markdown
Contributor

📦 Next.js Bundle Size Report (Gzipped Sizes)

✨ No significant bundle size changes detected.

📊 Summary of Totals

Category PR Size Base Size Difference
Total JS 3405.30 KB 3405.30 KB 0 B
Total CSS 252.94 KB 252.94 KB 0 B

@jatingow jatingow requested a review from Aamod-Dev June 13, 2026 14:04

@Aamod-Dev Aamod-Dev left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Excellent bugfix! I went through the changes and returning an actual SVG error badge instead of JSON when validation fails prevents GitHub profiles from displaying broken image links.
Labels applied:

  • level:advanced: Modifies core routing returns.
  • quality:clean: Proper SVG compilation.
  • ype:bug: Fixes severe image rendering issue.

@Aamod-Dev Aamod-Dev added the gssoc:approved PR has been reviewed and accepted for valid contribution points label Jun 14, 2026
@github-actions github-actions Bot added this to the GSSoC 2026 milestone Jun 14, 2026
@JhaSourav07 JhaSourav07 merged commit 66e897f into JhaSourav07:main Jun 14, 2026
6 of 7 checks passed
@github-actions

Copy link
Copy Markdown
Contributor

🎉 Congratulations @jatingow! Your PR has been successfully merged. 🚀

Thank you for contributing to CommitPulse. Your work helps us build a better tool for the community.

⚠️ Important for GSSoC Contributors:
You are strictly advised to join our Discord Server as it is mandatory for all GSSoC participants. All important announcements, point claims, and community discussions happen there.

Keep building! 💻✨

@jatingow jatingow deleted the fix/streak-api-svg-validation-error branch June 16, 2026 08:16
@JhaSourav07 JhaSourav07 added gssoc:approved PR has been reviewed and accepted for valid contribution points and removed gssoc:approved PR has been reviewed and accepted for valid contribution points labels Jun 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gssoc:approved PR has been reviewed and accepted for valid contribution points GSSoC 2026 level:advanced Complex contributions involving architecture, optimization, or significant feature work mentor:Aamod007 quality:clean PR follows clean coding practices, proper formatting, documentation, and maintainability standards. type:bug Something isn't working as expected

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug: /api/streak returns JSON instead of SVG on validation error

3 participants