Skip to content

fix(TRAC-1339): throw ValidationError for non-string input in urlParse and stripProtocol - #409

Closed
mfaris9 wants to merge 1 commit into
masterfrom
michaelfaris/trac-1339-url-helper-input-validation
Closed

fix(TRAC-1339): throw ValidationError for non-string input in urlParse and stripProtocol#409
mfaris9 wants to merge 1 commit into
masterfrom
michaelfaris/trac-1339-url-helper-input-validation

Conversation

@mfaris9

@mfaris9 mfaris9 commented Aug 17, 2026

Copy link
Copy Markdown
Contributor

Jira: TRAC-1339 (LTRAC-1395)

What? Why?

  • urlParse and stripProtocol passed input straight to url.parse(), so an undefined theme variable threw a raw TypeError and 500'd the whole page render
  • Both helpers now throw ValidationError for non-string input, which the renderer preserves (fix(TRAC-875): preserve ValidationError type in render/renderString #404) so it can surface as a 4xx template error pointing at the theme instead of a 500
  • Same pattern as strReplace and encodeHtmlEntities

How was it tested?

  • Added specs asserting both helpers throw ValidationError for undefined, number, and object input
  • npm test passes (890 tests), coverage 97.66%
  • npm run lint clean

cc @bigcommerce/storefront-team

🤖 Generated with Claude Code

…e and stripProtocol

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@mfaris9 mfaris9 closed this Aug 17, 2026
@mfaris9
mfaris9 deleted the michaelfaris/trac-1339-url-helper-input-validation branch August 17, 2026 18:45
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.

1 participant