Skip to content

Commit 3f7e98c

Browse files
Update src/url.zig
Co-authored-by: Sjors <[email protected]>
1 parent 16a1677 commit 3f7e98c

File tree

1 file changed

+4
-11
lines changed

1 file changed

+4
-11
lines changed

src/url.zig

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -153,18 +153,11 @@ pub const URL = struct {
153153
std.debug.assert(out[out_i - 1] == '/');
154154

155155
out_i -= 2;
156-
while (out_i > 1) {
157-
const next = out_i - 1;
158-
if (out[next] == '/') {
159-
// <= to deal with the hack-ish protocol_end which will be
160-
// off-by-one between http and https
161-
if (out_i <= protocol_end) {
162-
return error.InvalidURL;
163-
}
164-
break;
165-
}
166-
out_i = next;
156+
while (out_i > 1 and out[out_i - 1] != '/') {
157+
out_i -= 1;
167158
}
159+
// <= to deal with the hack-ish protocol_end which will be off-by-one between http and https
160+
if (out_i <= protocol_end) return error.InvalidURL;
168161
in_i += 3;
169162
continue;
170163
}

0 commit comments

Comments
 (0)