1
0
Fork 0
mirror of https://github.com/zigzap/zap.git synced 2025-10-20 23:24:09 +00:00

try anyway

This commit is contained in:
Rene Schallner 2023-09-12 18:04:09 +02:00
parent d1a0b6c15d
commit 5f939fd666

View file

@ -628,10 +628,20 @@ pub fn Fiobj2HttpParam(o: fio.FIOBJ, a: std.mem.Allocator, dupe_string: bool) !?
} else {
// the data
const data_len = fio.fiobj_data_len(data);
const data_buf = fio.fiobj_data_read(data, data_len);
var data_buf = fio.fiobj_data_read(data, data_len);
if (data_len < 0) {
std.log.warn("WARNING: HTTP param binary file size negative: {d}\n", .{data_len});
// try to read anyway
std.log.warn("WARNING: Attempting to read anyway\n", .{});
data_buf = fio.fiobj_data_read(data, 4096);
if (data_buf.len > 0) {
data_slice = data_buf.data[0..data_buf.len];
} else {
std.log.warn("WARNING: HTTP param binary file buffer size negative: {d}\n", .{data_buf.len});
data_slice = "(zap: invalid data: negative BUFFER size)";
}
} else {
if (data_buf.len != data_len) {
std.log.warn("WARNING: HTTP param binary file size mismatch: should {d}, is: {d}\n", .{ data_len, data_buf.len });