Merge pull request #1198 from lightpanda-io/nikneym/url-trim

Trim CR and LF characters from both ends
This commit is contained in:
Pierre Tachoire
2025-11-04 15:32:45 +01:00
committed by GitHub

View File

@@ -81,10 +81,12 @@ pub const URL = struct {
/// For URLs without a path, it will add src as the path. /// For URLs without a path, it will add src as the path.
pub fn stitch( pub fn stitch(
allocator: Allocator, allocator: Allocator,
path: []const u8, raw_path: []const u8,
base: []const u8, base: []const u8,
comptime opts: StitchOpts, comptime opts: StitchOpts,
) !StitchReturn(opts) { ) !StitchReturn(opts) {
const path = std.mem.trim(u8, raw_path, &.{ '\n', '\r' });
if (base.len == 0 or isCompleteHTTPUrl(path)) { if (base.len == 0 or isCompleteHTTPUrl(path)) {
return simpleStitch(allocator, path, opts); return simpleStitch(allocator, path, opts);
} }