Skip to content

Commit

Permalink
fix(util): correct URL validation logic
Browse files Browse the repository at this point in the history
The URL validation logic was incorrect. The condition was changed from
`URL.canParse(url)` to `!URL.canParse(url)` to properly throw an error
for invalid URLs.
  • Loading branch information
ryoppippi committed Aug 22, 2024
1 parent 80e5251 commit fb254ab
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { assert, ensure, is } from "@core/unknownutil";
export function validateURL(url: string) {
assert(url, is.String);

if (URL.canParse(url)) {
if (!URL.canParse(url)) {
throw new Error("Invalid URL");
}

Expand Down

0 comments on commit fb254ab

Please sign in to comment.