From fa4590171da9dcaf4b6f9dd6d07c23abd57475ff Mon Sep 17 00:00:00 2001 From: Luna Date: Tue, 13 Apr 2021 21:32:12 -0300 Subject: [PATCH] fix bodies having CRLF --- src/main.zig | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main.zig b/src/main.zig index a7f22d2..e225e31 100644 --- a/src/main.zig +++ b/src/main.zig @@ -242,7 +242,8 @@ const Multipart = struct { // read body until we find the boundary end marker (--{s} OR --{s}--) var it = std.mem.split(remaining_body, self.boundary); - const body = it.next() orelse return error.MissingPartBody; + const almost_actual_body = it.next() orelse return error.MissingPartBody; + const body = std.mem.trimRight(u8, almost_actual_body, "\r\n"); const next_boundary_pos = self.stream.pos + body.len; const next_boundary_body = self.stream.buffer[next_boundary_pos..self.stream.buffer.len];