Fix limit on rule parameters and fix segfault in applyScrobbleRule

For sure this time
This commit is contained in:
mitteneer 2025-04-27 16:27:03 -04:00
parent 18d4df0a5c
commit 01fe10f045
2 changed files with 10 additions and 3 deletions

View file

@ -61,7 +61,11 @@ pub fn applyScrobbleRule(allocator: std.mem.Allocator, scrobble: Data.ImportedSc
},
.replace => switch (act.action_on) {
inline .album, .track => |on| @field(output_scrobble, @tagName(on)) = act.action_txt,
inline .artists_album, .artists_track => |on| @field(output_scrobble, @tagName(on)) = &[_][]const u8{act.action_txt},
inline .artists_album, .artists_track => |on| {
const artist = try allocator.alloc([]const u8, 1);
artist[0] = act.action_txt;
@field(output_scrobble, @tagName(on)) = artist;
},
},
}
}

View file

@ -14,10 +14,13 @@ pub const jetzig_options = struct {
// htmx middleware skips layouts when `HX-Target` header is present and issues
// `HX-Redirect` instead of a regular HTTP redirect when `request.redirect` is called.
jetzig.middleware.HtmxMiddleware,
// Demo middleware included with new projects. Remove once you are familiar with Jetzig's
// middleware system.
// Demo middleware included with new projects. Remove once you are familiar with Jetzig's
// middleware system.
};
// This is currently the largest number of parameters one can have in a rule
pub const max_multipart_form_fields = 42;
// Maximum bytes to allow in request body.
pub const max_bytes_request_body: usize = std.math.pow(usize, 2, 24);