# HG changeset patch # User Mike Becker # Date 1507553747 -7200 # Node ID 2dc61cc5a8ac7992da1df8617b051f7de3669553 # Parent 18a8c7895b6d547db55bd9aaf0ff43ecf6cf303a adds error message to dav, when an invalid date format is specified for the -u option diff -r 18a8c7895b6d -r 2dc61cc5a8ac dav/main.c --- a/dav/main.c Sat Oct 07 10:40:21 2017 +0200 +++ b/dav/main.c Mon Oct 09 14:55:47 2017 +0200 @@ -648,6 +648,13 @@ time_t t = -1; if(update) { t = util_parse_lastmodified(update); + if (t == 0) { + fprintf(stderr, + "Invalid date format. Possible formats are:\n" + " RFC-1123 - example: Thu, 29 Nov 2012 21:35:35 GMT\n" + " RFC-3339 - example: 2012-11-29T21:35:35Z\n"); + return -1; + } } int recursive = cmd_getoption(a, "recursive") ? 1 : 0; diff -r 18a8c7895b6d -r 2dc61cc5a8ac libidav/utils.c --- a/libidav/utils.c Sat Oct 07 10:40:21 2017 +0200 +++ b/libidav/utils.c Mon Oct 09 14:55:47 2017 +0200 @@ -181,8 +181,9 @@ } else { time_t result = curl_getdate(str, NULL); if(result == -1) { - // some shit server don't comply with the WebDAV standard and - // use ISO-8601 dates for lastmodified (e.g. Microsoft Sharepoint) + // fall back to the ISO-8601 format (e.g. Microsoft Sharepoint + // illegally uses this format for lastmodified, but also some + // users might want to give an ISO-8601 date) return util_parse_creationdate(str); } else { return result;