-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
v4: URL parser does not accept localhost
as a valid hostname
#4103
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
BTW, I'm not sure if this is truly considered a bug or if this behavior is expected (I expect it's a bug, given that it breaks with the expectations of zod v3) but if it's the case, I'd be willing to offer a PR if that helps 🙂 |
Sam issue! I was trying to migrate a tiny app that relies on the old |
not just crude workaround:
|
Also encountering this issue. I made a repository here: https://github.com/0xBison/zod-url-issue with various tests It also seems to allow urls like: |
I'm parsing a postgres connection URL with the new v4
z.url()
schema and it seems to fail locally.Going a bit deeper in my investigation, I notice that the URL parser here validates the
hostname
against this regex which doesn't match onlocalhost
.The text was updated successfully, but these errors were encountered: