summaryrefslogtreecommitdiff
path: root/html.c
diff options
context:
space:
mode:
Diffstat (limited to 'html.c')
-rw-r--r--html.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/html.c b/html.c
index 322bafa..c55937d 100644
--- a/html.c
+++ b/html.c
@@ -2275,18 +2275,18 @@ xs_html *html_entry(snac *user, xs_dict *msg, int read_only,
2275 if (strcmp(type, "Event") == 0) { /** Event start and end times **/ 2275 if (strcmp(type, "Event") == 0) { /** Event start and end times **/
2276 const char *s_time = xs_dict_get(msg, "startTime"); 2276 const char *s_time = xs_dict_get(msg, "startTime");
2277 2277
2278 if (xs_type(s_time) == XSTYPE_STRING) { 2278 if (xs_is_string(s_time) && strlen(s_time) > 20) {
2279 const char *e_time = xs_dict_get(msg, "endTime"); 2279 const char *e_time = xs_dict_get(msg, "endTime");
2280 const char *tz = xs_dict_get(msg, "timezone"); 2280 const char *tz = xs_dict_get(msg, "timezone");
2281 2281
2282 xs *s = xs_replace_i(xs_dup(s_time), "T", " "); 2282 xs *s = xs_replace_i(xs_dup(s_time), "T", " ");
2283 xs *e = NULL; 2283 xs *e = NULL;
2284 2284
2285 if (xs_type(e_time) == XSTYPE_STRING) 2285 if (xs_is_string(e_time) && strlen(e_time) > 20)
2286 e = xs_replace_i(xs_dup(e_time), "T", " "); 2286 e = xs_replace_i(xs_dup(e_time), "T", " ");
2287 2287
2288 /* if the event has a timezone, crop the offsets */ 2288 /* if the event has a timezone, crop the offsets */
2289 if (xs_type(tz) == XSTYPE_STRING) { 2289 if (xs_is_string(tz)) {
2290 s = xs_crop_i(s, 0, 19); 2290 s = xs_crop_i(s, 0, 19);
2291 2291
2292 if (e) 2292 if (e)
@@ -2297,7 +2297,7 @@ xs_html *html_entry(snac *user, xs_dict *msg, int read_only,
2297 2297
2298 /* if start and end share the same day, crop it from the end */ 2298 /* if start and end share the same day, crop it from the end */
2299 if (e && memcmp(s, e, 11) == 0) 2299 if (e && memcmp(s, e, 11) == 0)
2300 e = xs_crop_i(e, 11, strlen(e)); 2300 e = xs_crop_i(e, 11, 0);
2301 2301
2302 if (e) 2302 if (e)
2303 s = xs_str_cat(s, " / ", e); 2303 s = xs_str_cat(s, " / ", e);