Trimming outer '"' when parsing the values.

This commit is contained in:
Leonardo Gibrowski Faé 2022-04-21 01:06:04 -03:00
parent 4c4a20d835
commit 0d878e8b5c
2 changed files with 14 additions and 1 deletions

View file

@ -231,6 +231,10 @@ For boolean tags, negation is done with a preceding '~':
~<tag>
To match for empty strings, use ' "" ':
<tag> == ""
In addition to explicit tag values, you can also specify a
default/fallback particle.

View file

@ -203,7 +203,16 @@ map_condition_from_str(const char *str)
op_str[0] = '\0';
cond->tag = strdup(trim(tag));
cond->value = value != NULL ? strdup(trim(value)) : NULL;
cond->value = NULL;
if (value != NULL){
value = trim(value);
if (value[0] == '"' && value[strlen(value) - 1] == '"'){
value[strlen(value) - 1] = '\0';
++value;
}
cond->value = strdup(value);
}
free(str_cpy);
return cond;