Remove troublesome symbols from output

This commit is contained in:
Lorenz Kästle 2026-03-06 15:49:43 +01:00
parent 0f0865c910
commit d7b86eedee

View file

@ -259,6 +259,21 @@ mp_state_enum mp_eval_check_default(const mp_check check) {
return result;
}
// Remove troublesome symbols from plugin output
char *sanitize_output_insitu(char *input) {
if (input == NULL) {
return input;
}
for (char *walker = input; *walker != '\0'; walker++) {
if (*walker == '|') {
*walker = ' ';
}
}
return input;
}
/*
* Generate output string for a mp_check object
* Non static to be available for testing functions
@ -299,6 +314,8 @@ char *mp_fmt_output(mp_check check) {
subchecks = subchecks->next;
}
result = sanitize_output_insitu(result);
if (pd_string != NULL && strlen(pd_string) > 0) {
asprintf(&result, "%s|%s", result, pd_string);
}