fix: use shared sanitizeFont in generateMonthlySVG and generateAutoThemeMonthlySVG#907
Conversation
…emeMonthlySVG - Both functions defined a local sanitizeFont that stripped single quotes - This shadowed the imported sanitizeFont from lib/svg/sanitizer.ts - Replace both local definitions with the shared imported function - Ensures consistent font sanitization across all badge views
|
@KaparthyReddy is attempting to deploy a commit to the jhasourav07's projects Team on Vercel. A member of the Team first needs to authorize it. |
|
👋 Hey @KaparthyReddy, welcome to CommitPulse! 🎉 Thanks for opening your first pull request — this is a big deal and we appreciate the effort! While you wait for a review, please double-check:
A maintainer will review your PR shortly. Hang tight! 🚀 |
|
Please pull the latest changes and resolve the conflicts so we can review it! git fetch origin
git rebase origin/main
# resolve any conflicts, then:
git push --force-with-leaseOnce resolved, the |
|
🚨 Hey @KaparthyReddy, the CI Pipeline is failing on this PR and it has been marked as Please fix the issues before this can be reviewed. Here's how: 1. Run checks locally before pushing: npm run format:check # Check Prettier formatting
npm run lint # Run ESLint
npm run typecheck # TypeScript type check
npm run test # Run unit tests (Vitest)
npm run build # Verify production build passes2. Auto-fix common issues: npm run format # Auto-fix formatting with Prettier
npm run lint -- --fix # Auto-fix lint errors where possible3. Check the full failure log here: Once you push a fix and the CI passes, the |
|
🎉 Congratulations @KaparthyReddy! Your PR has been successfully merged. 🚀 Thank you for contributing to CommitPulse. Your work helps us build a better tool for the community.
Keep building! 💻✨ |
Fixes #905
Description
Both
generateMonthlySVGandgenerateAutoThemeMonthlySVGinlib/svg/generator.tsdefined their own localsanitizeFontfunction:const sanitizeFont = (name: string) => name.replace(/[^a-zA-Z0-9\s-]/g, '').trim();
This shadowed the imported
sanitizeFontfromlib/svg/sanitizer.tsand stripped single quotes from font names. The real shared sanitizer explicitly allows single quotes (/[^a-zA-Z0-9\s\-']/g), meaning font names behaved differently in monthly view vs the default view — a silent inconsistency with no error thrown.The fix removes both local definitions and replaces them with the already-imported shared
sanitizeFont, making font sanitization consistent across all badge views.Files changed:
lib/svg/generator.tsonly — 2 lines removed, 2 lines simplified.Pillar
Visual Preview
N/A — font sanitization logic fix, no visual change for valid font names.
Checklist before requesting a review:
CONTRIBUTING.mdfile.npm run formatandnpm run lintlocally and resolved all errors.README.mdif I added a new theme or URL parameter.