re-order end-of-hostname validity check

This commit is contained in:
Kristófer R
2025-05-13 23:15:23 -04:00
parent bb07e9c026
commit a24d0c9faf

View File

@@ -55,8 +55,8 @@ pub fn parseUrl(url: []const u8) !std.Uri {
// The first '/' after the scheme marks the end of the hostname. If the first '/'
// following the end of the scheme is not at the right position this is not a
// valid mac address.
if (std.mem.indexOfScalarPos(u8, url_without_scheme, 0, '/') != 17 and
url_without_scheme.len != 17)
if (url_without_scheme.len != 17 and
std.mem.indexOfScalarPos(u8, url_without_scheme, 0, '/') != 17)
{
return error.HostnameIsNotMacAddress;
}