mirror of
https://github.com/lightpanda-io/browser.git
synced 2025-12-15 15:58:57 +00:00
Merge pull request #1198 from lightpanda-io/nikneym/url-trim
Trim CR and LF characters from both ends
This commit is contained in:
@@ -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);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user