Skip to content

Fix TSX Badge URL Extraction in ExportPanel - #8907

Open
tamilr0727-ux wants to merge 1 commit into
JhaSourav07:mainfrom
tamilr0727-ux:fix/tsx-badge-download-url
Open

Fix TSX Badge URL Extraction in ExportPanel#8907
tamilr0727-ux wants to merge 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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug: "Download SVG" fails when export format is set to TSX

1 participant