Skip to content

fix(layout): Prevent TypeError from invalid link href - #438

Open
sentry[bot] wants to merge 1 commit into
mainfrom
seer/fix/layout-invalid-url-FLa3M9
Open

fix(layout): Prevent TypeError from invalid link href#438
sentry[bot] wants to merge 1 commit into
mainfrom
seer/fix/layout-invalid-url-FLa3M9

Conversation

@sentry

@sentry sentry Bot commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

This PR addresses issue BLOG-4P, a TypeError: Failed to construct 'URL': Invalid URL originating from the isInternalNavigationLink function in src/layouts/layout.astro.

The new URL(link.href, window.location.href) call at line 135 was throwing an unhandled TypeError when link.href resolved to a malformed or invalid URL string not caught by the preceding guards. This caused crashes for users encountering such links.

The fix involves wrapping the new URL() constructor call in a try-catch block. If the URL construction fails, the function now gracefully returns false, treating the malformed link as a non-internal navigation link and preventing the unhandled exception.

Fixes BLOG-4P

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.

0 participants