commit 9327286516f1f545795b741921ec8c8939afe595
parent f65a20ac306d2ddfbeb5397e201288f0c22ac711
Author: Andrej Kacian <ticho@claws-mail.org>
Date: Sat, 4 Mar 2017 00:12:29 +0100
Add support for date-only variant of ISO8601 timestamp format.
Fixes bug #3777 - Weird news dates for some RSS feeds
Diffstat:
1 file changed, 13 insertions(+), 2 deletions(-)
diff --git a/src/procheader.c b/src/procheader.c
@@ -947,8 +947,8 @@ static gint procheader_scan_date_string(const gchar *str,
*zone = '\0';
- /* RFC3339 subset */
- /* This particular "subset" is invalid, RFC requires the time offset */
+ /* RFC3339 subset, no fraction of second, and no timezone offset */
+ /* This particular "subset" is invalid, RFC requires the offset */
result = sscanf(str, "%4d-%2d-%2d %2d:%2d:%2d",
year, &month_n, day, hh, mm, ss);
if (result == 6) {
@@ -958,6 +958,17 @@ static gint procheader_scan_date_string(const gchar *str,
}
}
+ /* ISO8601 format with just date (YYYY-MM-DD) */
+ result = sscanf(str, "%4d-%2d-%2d",
+ year, &month_n, day);
+ if (result == 3) {
+ *hh = *mm = *ss = 0;
+ if (1 <= month_n && month_n <= 12) {
+ strncpy2(month, monthstr+((month_n-1)*3), 4);
+ return 0;
+ }
+ }
+
return -1;
}