From a25875170bc17519255c8679e3d825e90334bd02 Mon Sep 17 00:00:00 2001 From: Nick Craig-Wood Date: Fri, 14 Sep 2018 11:45:50 +0100 Subject: [PATCH] webdav: Add another time format to fix #2574 --- backend/webdav/api/types.go | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/backend/webdav/api/types.go b/backend/webdav/api/types.go index b92cc97b9..983825418 100644 --- a/backend/webdav/api/types.go +++ b/backend/webdav/api/types.go @@ -12,6 +12,9 @@ import ( const ( // Wed, 27 Sep 2017 14:28:34 GMT timeFormat = time.RFC1123 + // The same as time.RFC1123 with optional leading zeros on the date + // see https://github.com/ncw/rclone/issues/2574 + noZerosRFC1123 = "Mon, _2 Jan 2006 15:04:05 MST" ) // Multistatus contains responses returned from an HTTP 207 return code @@ -138,9 +141,10 @@ func (t *Time) MarshalXML(e *xml.Encoder, start xml.StartElement) error { // Possible time formats to parse the time with var timeFormats = []string{ - timeFormat, // Wed, 27 Sep 2017 14:28:34 GMT (as per RFC) - time.RFC1123Z, // Fri, 05 Jan 2018 14:14:38 +0000 (as used by mydrive.ch) - time.UnixDate, // Wed May 17 15:31:58 UTC 2017 (as used in an internal server) + timeFormat, // Wed, 27 Sep 2017 14:28:34 GMT (as per RFC) + time.RFC1123Z, // Fri, 05 Jan 2018 14:14:38 +0000 (as used by mydrive.ch) + time.UnixDate, // Wed May 17 15:31:58 UTC 2017 (as used in an internal server) + noZerosRFC1123, // Fri, 7 Sep 2018 08:49:58 GMT (as used by server in #2574) } // UnmarshalXML turns XML into a Time