Skip to content

Fix TSX Badge URL Extraction in ExportPanel - #8907

Merged
JhaSourav07 merged 1 commit into
JhaSourav07:mainfrom
tamilr0727-ux:fix/tsx-badge-download-url
Aug 10, 2026
Merged

Fix TSX Badge URL Extraction in ExportPanel#8907
JhaSourav07 merged 1 commit into
JhaSourav07:mainfrom
tamilr0727-ux:fix/tsx-badge-download-url

Conversation

@tamilr0727-ux

Copy link
Copy Markdown
Contributor

Description

Fixes badge download failures in ExportPanel.tsx when the export format is set to TSX by improving badge URL extraction to support all supported snippet formats.

Changes

  • Updated badge URL extraction logic to correctly handle TSX export snippets.
  • Extended parsing to support URLs embedded in JavaScript template literals in addition to the existing Markdown and HTML formats.
  • Ensured download actions (SVG, PNG, and PDF) use the extracted badge URL regardless of the selected export format.
  • Preserved existing behavior for Markdown and HTML snippets.
  • Added regression tests covering all supported export formats.

Validation

Implemented tests covering:

  • Successful URL extraction from Markdown snippets.
  • Successful URL extraction from HTML snippets.
  • Successful URL extraction from TSX template literal snippets.
  • SVG, PNG, and PDF downloads using the extracted URL.
  • Invalid or malformed snippets continuing to return an appropriate error instead of failing unexpectedly.

Verification

vitest run passes successfully.
✅ Badge downloads work correctly for Markdown, HTML, and TSX export formats.
✅ Existing download functionality remains unchanged for previously supported formats.

Fixes #8769

Pillar

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

Visual Preview

Can Check in the Files Changed Section.

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 Aug 6, 2026

Copy link
Copy Markdown
Contributor

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

A member of the Team first needs to authorize it.

@retenta-bot

retenta-bot Bot commented Aug 6, 2026

Copy link
Copy Markdown

This PR addresses badge download failures by improving the URL extraction logic for TSX formats, ensuring compatibility with various snippet types. It also includes regression tests to maintain existing functionality. This aligns with our previous decisions to enhance testing and ensure robust handling of different formats. Thank you for your contributions!

@retenta-bot retenta-bot Bot changed the title fix(export): resolve TSX badge target URL extraction parsing Fix TSX Badge URL Extraction in ExportPanel Aug 6, 2026
@github-actions

github-actions Bot commented Aug 6, 2026

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 4939.25 KB 4939.27 KB -0.01 KB (-0.00%)
Total CSS 348.46 KB 348.46 KB 0 B

@Aamod007 Aamod007 added 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 mentor:Aamod007 labels Aug 9, 2026

@Aamod007 Aamod007 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 fix for the TSX Badge URL extraction! Mocking \URL.createObjectURL\ properly in JSDOM tests is crucial for testing the download functionality. Approved!

@JhaSourav07 JhaSourav07 added the gssoc:approved PR has been reviewed and accepted for valid contribution points label Aug 10, 2026
@JhaSourav07
JhaSourav07 merged commit 68860dc into JhaSourav07:main Aug 10, 2026
10 of 11 checks passed
@github-actions github-actions Bot added this to the GSSoC 2026 milestone Aug 10, 2026
@github-actions

Copy link
Copy Markdown
Contributor

🎉 Congratulations @tamilr0727-ux! 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! 💻✨

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 level:intermediate Moderate complexity tasks 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: "Download SVG" fails when export format is set to TSX

3 participants