fix(xtask): Fix an infinite loop when parsing the fields of a span.

The error was coming from the subslice from `message` instead of
`fields`.

This patch also fixes an HTML error (`</li>` right after `<ul>`).
This commit is contained in:
Ivan Enderlin
2026-02-25 15:36:42 +01:00
parent b7b96d49c5
commit 4d9268d104

View File

@@ -72,7 +72,7 @@ lazy_static! {
^
# A name.
(?<name>[\w\d_]+)
\s*(?<name>[\w\d_]+)
# Equal
=
# A value, which can be anything: it stops when a new field is found.
@@ -333,9 +333,9 @@ pub(super) fn run(log_path: path::PathBuf, output_path: path::PathBuf) -> Result
.unwrap();
if let Some(fields) = captures.name("fields") {
writeln!(buffer, "<ul class=\"fields\"></li>").unwrap();
writeln!(buffer, "<ul class=\"fields\">").unwrap();
let mut fields = &message[fields.start()..];
let mut fields = &message[fields.start()..fields.end()];
while let Some(captures) = fields_parser.captures(fields) {
let name = captures
@@ -350,7 +350,7 @@ pub(super) fn run(log_path: path::PathBuf, output_path: path::PathBuf) -> Result
writeln!(buffer, "<li><span>{name}</span><span>{value}</span></li>").unwrap();
if let Some(next_fields) = captures.name("next_fields") {
fields = &message[next_fields.start()..];
fields = &fields[next_fields.start()..];
} else {
break;
}