Filter: Fix Loading of Negated Conditions from git.

Fix loading of the negation of filter conditions. Unlike other
conditions that are persisted as `<key>="<value>"`, this is persisted
to git as `negate`.
This fix remediates this for all cases where the condition has already
been saved to the cloud storage.

Saving to XML takes a different approach and indicates negated
conditions with `negate="1"`, making it identical to all other
attributes. The question is if this approach should be implemented in
addition to the above fix, in order to unify the storage format.

Fixes #4246.

Signed-off-by: Michael Keller <github@ike.ch>
This commit is contained in:
Michael Keller 2024-06-14 21:05:30 +12:00 committed by bstoeger
parent b126fccb1b
commit 31fca0f676

View file

@ -357,23 +357,27 @@ static char *parse_keyvalue_entry(void (*fn)(void *, const char *, const std::st
line++;
}
if (c == '=')
if (c != 0)
*line++ = 0;
char *start_val = line;
while ((c = *line) != 0) {
if (isspace(c))
break;
line++;
std::string val;
if (c == '=') {
const char *start_val = line;
while ((c = *line) != 0) {
if (isspace(c))
break;
line++;
}
/* Did we get a string? Take it from the list of strings */
val = start_val[0] == '"' ? pop_cstring(state, key)
: std::string(start_val, line - start_val);
if (c)
line++;
}
/* Did we get a string? Take it from the list of strings */
std::string val = start_val[0] == '"' ? pop_cstring(state, key)
: std::string(start_val, line - start_val);
if (c)
line++;
fn(fndata, key, val);
return line;
}