Skip to content

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

Merged
mfaris9 merged 1 commit into
masterfrom
TRAC-1339
Aug 17, 2026
Merged

fix(TRAC-1339): throw ValidationError for non-string input in urlParse and stripProtocol#410
mfaris9 merged 1 commit into
masterfrom
TRAC-1339

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
  • Tested in stencil-cli: "Non-string passed to urlParse : Error: Non-string passed to urlParse"

cc @bigcommerce/storefront-team

🤖 Generated with Claude Code

…e and stripProtocol

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@mfaris9
mfaris9 marked this pull request as ready for review August 17, 2026 19:37
@mfaris9
mfaris9 merged commit bafbb03 into master Aug 17, 2026
12 checks passed
@github-actions

Copy link
Copy Markdown
Contributor

🎉 This PR is included in version 6.6.4 🎉

The release is available on:

Your semantic-release bot 📦🚀

@mfaris9
mfaris9 deleted the TRAC-1339 branch August 17, 2026 22:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants