Skip to content

Commit

Permalink
Update src/url.zig
Browse files Browse the repository at this point in the history
Co-authored-by: Jarred Sumner <[email protected]>
  • Loading branch information
cirospaciari and Jarred-Sumner authored Feb 13, 2025
1 parent 929b55c commit 1514607
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/url.zig
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ pub const URL = struct {
/// host + path without the ending slash, protocol, searchParams and hash
pub fn hostWithPath(this: *const URL) []const u8 {
if (this.host.len > 0) {
if (this.path.len > 1) {
if (this.path.len > 1 and bun.isSliceInBuffer(this.path, this.href) and bun.isSliceInBuffer(this.host, this.href)) {
const end = @intFromPtr(this.path.ptr) + this.path.len;
const start = @intFromPtr(this.host.ptr);
const len: usize = end - start - (if (bun.strings.endsWithComptime(this.path, "/")) @as(usize, 1) else @as(usize, 0));
Expand Down

0 comments on commit 1514607

Please sign in to comment.