summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAllen Winter <allen.winter@kdab.com>2022-09-24 11:05:57 -0400
committerAllen Winter <allen.winter@kdab.com>2022-09-24 11:05:57 -0400
commita73973a5bbd32d7d550177480b5a780188a59ae1 (patch)
tree291b54f3dd12732df9dd1bb2c66ef17a6b8d37be
parent80e3e82dfadf06c52fe100da6793bbddb415e449 (diff)
parent8b0117e01a04ad57cdb0652819eea181e2a3645f (diff)
downloadlibical-git-a73973a5bbd32d7d550177480b5a780188a59ae1.tar.gz
Merge branch '3.0'
-rw-r--r--.krazy1
-rw-r--r--ReleaseNotes.txt1
-rw-r--r--src/libical/icalparser.c4
-rw-r--r--src/libical/icalvalue.c3
-rw-r--r--src/test/regression.c19
5 files changed, 25 insertions, 3 deletions
diff --git a/.krazy b/.krazy
index 74c09410..3adce899 100644
--- a/.krazy
+++ b/.krazy
@@ -41,3 +41,4 @@ SKIP /zoneinfo/
STYLE_LINEMAX 120
STYLE_PYTHONSTYLE_OFFSET 4
+STYLE_CMAKESTYLE_OFFSET 2
diff --git a/ReleaseNotes.txt b/ReleaseNotes.txt
index 898fac72..7b08c0ea 100644
--- a/ReleaseNotes.txt
+++ b/ReleaseNotes.txt
@@ -56,6 +56,7 @@ Version 3.0.15 (UNRELEASED):
----------------------------
* Add missing property parameters into libical-glib
* Fix CMake option USE_32BIT_TIME_T actually uses a 32-bit time_t value
+ * Fix x-property comma handling and escaping
Version 3.0.14 (05 February 2022):
----------------------------------
diff --git a/src/libical/icalparser.c b/src/libical/icalparser.c
index 3aaba0c8..faa40b1a 100644
--- a/src/libical/icalparser.c
+++ b/src/libical/icalparser.c
@@ -400,8 +400,8 @@ static char *parser_get_next_value(char *line, char **end, icalvalue_kind kind)
continue;
}
}
- /* ignore all , for query value. select dtstart, dtend etc ... */
- else if (kind == ICAL_QUERY_VALUE) {
+ /* ignore all commas for query and x values. select dtstart, dtend etc ... */
+ else if (kind == ICAL_QUERY_VALUE || kind == ICAL_X_VALUE) {
if (next != 0) {
p = next + 1;
continue;
diff --git a/src/libical/icalvalue.c b/src/libical/icalvalue.c
index 84be221d..911f68fc 100644
--- a/src/libical/icalvalue.c
+++ b/src/libical/icalvalue.c
@@ -303,7 +303,8 @@ static char *icalmemory_strdup_and_quote(const icalvalue *value, const char *unq
if ((icalproperty_isa(value->parent) == ICAL_CATEGORIES_PROPERTY) ||
(icalproperty_isa(value->parent) == ICAL_RESOURCES_PROPERTY) ||
(icalproperty_isa(value->parent) == ICAL_POLLPROPERTIES_PROPERTY) ||
- (icalproperty_isa(value->parent) == ICAL_LOCATIONTYPE_PROPERTY)) {
+ (icalproperty_isa(value->parent) == ICAL_LOCATIONTYPE_PROPERTY) ||
+ (icalproperty_isa(value->parent) == ICAL_X_PROPERTY)) {
icalmemory_append_char(&str, &str_p, &buf_sz, *p);
break;
}
diff --git a/src/test/regression.c b/src/test/regression.c
index 8f036110..9131f71f 100644
--- a/src/test/regression.c
+++ b/src/test/regression.c
@@ -5215,6 +5215,24 @@ test_icalvalue_resets_timezone_on_set(void)
static void test_remove_tzid_from_due(void)
{
+ icalproperty *xproperty = icalproperty_new_from_string("X-TEST-PROPERTY:test,test");
+ icalcomponent *c;
+
+ c = icalcomponent_vanew(
+ ICAL_VCALENDAR_COMPONENT,
+ icalcomponent_vanew(
+ ICAL_VEVENT_COMPONENT,
+ xproperty,
+ 0),
+ 0);
+
+ str_is("icalproperty_as_ical_string()", "X-TEST-PROPERTY:test,test\r\n", icalproperty_as_ical_string(icalcomponent_get_first_property(icalcomponent_get_inner(c), ICAL_X_PROPERTY)));
+
+ icalcomponent_free(c);
+}
+
+static void test_comma_in_xproperty(void)
+{
icalproperty *due = icalproperty_vanew_due(icaltime_from_string("20220120T120000"), 0);
icalcomponent *c;
@@ -5394,6 +5412,7 @@ int main(int argc, char *argv[])
test_run("Test icalvalue resets timezone on set", test_icalvalue_resets_timezone_on_set, do_test, do_header);
test_run("Test removing TZID from DUE with icalcomponent_set_due", test_remove_tzid_from_due, do_test, do_header);
test_run("Test geo precision", test_geo_props, do_test, do_header);
+ test_run("Test commas in x-property", test_comma_in_xproperty, do_test, do_header);
/** OPTIONAL TESTS go here... **/