diff options
author | Lukas Fleischer <calcurse@cryptocrack.de> | 2014-07-08 13:12:43 +0200 |
---|---|---|
committer | Lukas Fleischer <calcurse@cryptocrack.de> | 2014-07-08 13:14:08 +0200 |
commit | 936d5f139f0450ab1d6af96b5d91a776483e0455 (patch) | |
tree | bf5d34acf150c069aede591774a527f7fd58058a /src | |
parent | 82aa3e3f43b758fd0c22439288dc8d4e36515ae1 (diff) | |
download | calcurse-936d5f139f0450ab1d6af96b5d91a776483e0455.zip |
ical.c: Remove newlines from item summaries
Newline characters are not allowed in calcurse item descriptions.
Replace any newlines in iCal summary lines with spaces.
Fixes GitHub issue #6.
Reported-by: Jonathan McCrohan <jmccrohan@gmail.com>
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
Diffstat (limited to 'src')
-rw-r--r-- | src/ical.c | 18 |
1 files changed, 12 insertions, 6 deletions
@@ -843,13 +843,19 @@ static char *ical_read_summary(char *line) { char *p, *summary; - if ((p = strchr(line, ':')) != NULL) { - p++; - summary = ical_unformat_line(p); - return summary; - } else { + p = strchr(line, ':'); + if (!p) return NULL; - } + + summary = ical_unformat_line(p + 1); + if (!summary) + return NULL; + + /* Event summaries must not contain newlines. */ + for (p = strchr(summary, '\n'); p; p = strchr(p, '\n')) + *p = ' '; + + return summary; } static void |