filters: fix calendar filter parsing

Fix parsing of colons. Since the field separator is also the colon, it
could mess up the parsed fields, i.e. a subject line like "WG: dinner"
could end up as "WG" instead of keeping the entire string.

Fixes: ab941eb ("filters: posix compliant rewrite of calendar filter")
Signed-off-by: Koni Marti <koni.marti@gmail.com>
Acked-by: Robin Jarry <robin@jarry.cc>
This commit is contained in:
Koni Marti 2022-08-11 16:52:04 +02:00 committed by Robin Jarry
parent 132b5fed9e
commit 0db924dc14

View file

@ -115,20 +115,24 @@ BEGIN {
}
/^UID/ {
id = $2
line = prepare($0)
id = line
}
/^STATUS/ {
status = $2
line = prepare($0)
status = line
}
/^DESCRIPTION/ {
entry = entry $2
line = prepare($0)
entry = entry line
indescription = 1;
}
/^SUMMARY/ {
summary = $2
line = prepare($0)
summary = line
insummary = 1;
}
@ -138,7 +142,8 @@ BEGIN {
}
/^LOCATION/ {
location = unescape($2, 0);
line = prepare($0)
location = unescape(line, 0);
inlocation = 1;
}
@ -187,6 +192,11 @@ BEGIN {
}
}
func prepare(line) {
gsub($1, "", line)
gsub(/^[: ]/, "", line)
return line
}
function unescape(input, preserve_newlines)
{
@ -237,6 +247,7 @@ function add_attendee(attendee)
function find_full_name(line)
{
name = get_value(line, "CN=[^;:]+", "=")
gsub(/"[^"]*"/,"",line)
email = get_value(line, "(mailto|MAILTO):[^;]+", ":")
if (name == "") {