Skip to content

fix: handle invalid URL parsing in useFeedSafeUrl hook#4823

Merged
DIYgod merged 1 commit intodevfrom
DIYgod/fix-url-parsing
Jan 30, 2026
Merged

fix: handle invalid URL parsing in useFeedSafeUrl hook#4823
DIYgod merged 1 commit intodevfrom
DIYgod/fix-url-parsing

Conversation

@DIYgod
Copy link
Member

@DIYgod DIYgod commented Jan 30, 2026

Wrap new URL() constructor in try-catch to gracefully handle malformed URL strings that start with 'http' but are invalid. Returns null instead of throwing TypeError.

This fixes the 'Failed to construct URL: Invalid URL' error that was occurring in the useFeedSafeUrl hook when processing certain malformed URLs.

Wrap new URL() constructor in try-catch to gracefully handle malformed URL strings that start with 'http' but are invalid. Returns null instead of throwing.

Co-Authored-By: Claude Haiku 4.5 <[email protected]>
@safedep
Copy link

safedep bot commented Jan 30, 2026

SafeDep Report Summary

Green Malicious Packages Badge Green Vulnerable Packages Badge Green Risky License Badge

No dependency changes detected. Nothing to scan.

This report is generated by SafeDep Github App

@DIYgod DIYgod merged commit 62efdd2 into dev Jan 30, 2026
8 of 9 checks passed
@DIYgod DIYgod deleted the DIYgod/fix-url-parsing branch January 30, 2026 05:48
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