Skip to content

Commit bc29fce

Browse files
Merge pull request #1198 from lightpanda-io/nikneym/url-trim
Trim CR and LF characters from both ends
2 parents 5b08188 + 97c92d7 commit bc29fce

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/url.zig

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,10 +81,12 @@ pub const URL = struct {
8181
/// For URLs without a path, it will add src as the path.
8282
pub fn stitch(
8383
allocator: Allocator,
84-
path: []const u8,
84+
raw_path: []const u8,
8585
base: []const u8,
8686
comptime opts: StitchOpts,
8787
) !StitchReturn(opts) {
88+
const path = std.mem.trim(u8, raw_path, &.{ '\n', '\r' });
89+
8890
if (base.len == 0 or isCompleteHTTPUrl(path)) {
8991
return simpleStitch(allocator, path, opts);
9092
}

0 commit comments

Comments
 (0)