Skip to content

Trim portfolio URL before validation to fix false-positive rejection#61

Merged
cdsaidev merged 1 commit into
mainfrom
fix/application-portfolio-url-validation
Jul 5, 2026
Merged

Trim portfolio URL before validation to fix false-positive rejection#61
cdsaidev merged 1 commit into
mainfrom
fix/application-portfolio-url-validation

Conversation

@engdotme

@engdotme engdotme commented Jul 5, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Portfolio URLs with incidental leading/trailing whitespace (e.g. pasted from a browser address bar) were being rejected as invalid, even though the URL itself was valid.
  • Root cause: @IsUrl() (backend) and Zod's .url() (frontend) don't tolerate surrounding whitespace, while the WHATWG URL parser used elsewhere does — creating an inconsistent, surprising validation failure.
  • Fix: trim the portfolio field before validation in both the application and profile DTOs (backend, via class-transformer's @Transform) and in the shared optionalUrl Zod helper (frontend), so whitespace no longer causes a false-positive rejection.

Changes

  • backend/src/modules/account/dto/update-profile.dto.ts: trim portfolio before @IsUrl()
  • backend/src/modules/applications/dto/create-application.dto.ts: trim portfolio before @IsUrl()
  • frontend/src/constants/shared/social-profiles.ts: add .trim() to optionalUrl
  • Added tests covering: whitespace-padded valid URLs are accepted, and non-URL values remain rejected after trimming

Test plan

  • Unit tests added/updated for backend DTOs (account/dto.spec.ts, applications/dto.spec.ts) and frontend schemas (apply-form.test.ts, profile-form-schema.test.ts)
  • Manually verify: submitting a profile/application form with a portfolio URL containing leading/trailing spaces succeeds

@vercel

vercel Bot commented Jul 5, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
forgeng-frontend Ready Ready Preview, Comment Jul 5, 2026 4:00pm

@engdotme engdotme requested a review from cdsaidev July 5, 2026 16:00
@engdotme engdotme marked this pull request as ready for review July 5, 2026 16:01
@github-actions

github-actions Bot commented Jul 5, 2026

Copy link
Copy Markdown

Backend coverage

Backend coverage

Lines Statements Branches Functions
Coverage: 72%
71.41% (1434/2008) 64.93% (852/1312) 73.78% (273/370)

@github-actions

github-actions Bot commented Jul 5, 2026

Copy link
Copy Markdown

Frontend coverage

Frontend coverage

Lines Statements Branches Functions
Coverage: 31%
31.29% (819/2617) 24.61% (400/1625) 25.56% (192/751)

@cdsaidev cdsaidev left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Good job, thanks

@cdsaidev cdsaidev merged commit 3926659 into main Jul 5, 2026
4 checks passed
@cdsaidev cdsaidev deleted the fix/application-portfolio-url-validation branch July 5, 2026 16:03
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.

2 participants