summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMilan Crha <mcrha@redhat.com>2023-03-24 09:29:00 +0100
committerMilan Crha <mcrha@redhat.com>2023-03-24 09:29:00 +0100
commit444286d82116038d0b1d511d977144fbae1283ab (patch)
tree8df30f721005c8536d14fb49f7c24edeaab30bb9
parent92efc6dcaa3245416cba8c1c688156e61b4fa02d (diff)
downloadevolution-data-server-444286d82116038d0b1d511d977144fbae1283ab.tar.gz
WebDAV Notes: Fallback to derive component summary from description
When the component summary is not received, derive it from the first line of the description, thus the summary is not left empty. Related to https://gitlab.gnome.org/GNOME/evolution-data-server/-/issues/461
-rw-r--r--src/calendar/backends/webdav-notes/e-cal-backend-webdav-notes.c26
1 files changed, 25 insertions, 1 deletions
diff --git a/src/calendar/backends/webdav-notes/e-cal-backend-webdav-notes.c b/src/calendar/backends/webdav-notes/e-cal-backend-webdav-notes.c
index 83e04ed3d..1220e6bac 100644
--- a/src/calendar/backends/webdav-notes/e-cal-backend-webdav-notes.c
+++ b/src/calendar/backends/webdav-notes/e-cal-backend-webdav-notes.c
@@ -458,9 +458,33 @@ ecb_webdav_notes_new_icomp (glong creation_date,
i_cal_component_set_summary (icomp, summary);
}
- if (description)
+ if (description && *description) {
+ const gchar *current_summary;
+
i_cal_component_set_description (icomp, description);
+ current_summary = i_cal_component_get_summary (icomp);
+
+ if (!current_summary || !*current_summary) {
+ const gchar *pos;
+
+ pos = strchr (description, '\n');
+ if (pos && pos > description && pos[-1] == '\r')
+ pos--;
+
+ if (!pos) {
+ /* single line description */
+ i_cal_component_set_summary (icomp, description);
+ } else if (pos > description) {
+ gchar *tmp;
+
+ tmp = g_strndup (description, pos - description);
+ i_cal_component_set_summary (icomp, tmp);
+ g_free (tmp);
+ }
+ }
+ }
+
e_cal_util_component_set_x_property (icomp, E_WEBDAV_NOTES_X_ETAG, revision);
return icomp;