aboutsummaryrefslogtreecommitdiff
path: root/filters
diff options
context:
space:
mode:
authorKoni Marti <koni.marti@gmail.com>2022-08-11 16:52:04 +0200
committerRobin Jarry <robin@jarry.cc>2022-08-22 09:30:37 +0200
commit0db924dc14a38109d892613bb4e16159ff305350 (patch)
tree0570bd9b998c73a58a638c5945110adc46119c4c /filters
parent132b5fed9ee2ada3c4a32adc1a7484b01c7b2b05 (diff)
downloadaerc-0db924dc14a38109d892613bb4e16159ff305350.tar.gz
aerc-0db924dc14a38109d892613bb4e16159ff305350.zip
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>
Diffstat (limited to 'filters')
-rwxr-xr-xfilters/calendar21
1 files changed, 16 insertions, 5 deletions
diff --git a/filters/calendar b/filters/calendar
index b9bd3a01..2808e13f 100755
--- a/filters/calendar
+++ b/filters/calendar
@@ -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 == "") {