diff --git a/webdav/prop.go b/webdav/prop.go index ac6c65a1..14594663 100644 --- a/webdav/prop.go +++ b/webdav/prop.go @@ -118,7 +118,14 @@ var liveProps = map[xml.Name]struct { }, xml.Name{Space: "DAV:", Local: "getlastmodified"}: { findFn: findLastModified, - dir: false, + // http://webdav.org/specs/rfc4918.html#PROPERTY_getlastmodified + // suggests that getlastmodified should only apply to GETable + // resources, and this package does not support GET on directories. + // + // Nonetheless, some WebDAV clients expect child directories to be + // sortable by getlastmodified date, so this value is true, not false. + // See golang.org/issue/15334. + dir: true, }, xml.Name{Space: "DAV:", Local: "creationdate"}: { findFn: nil, diff --git a/webdav/prop_test.go b/webdav/prop_test.go index ee188acd..0834dc9f 100644 --- a/webdav/prop_test.go +++ b/webdav/prop_test.go @@ -77,6 +77,7 @@ func TestMemPS(t *testing.T) { {Space: "DAV:", Local: "resourcetype"}, {Space: "DAV:", Local: "displayname"}, {Space: "DAV:", Local: "supportedlock"}, + {Space: "DAV:", Local: "getlastmodified"}, }, }, { op: "propname", @@ -105,6 +106,9 @@ func TestMemPS(t *testing.T) { }, { XMLName: xml.Name{Space: "DAV:", Local: "displayname"}, InnerXML: []byte("dir"), + }, { + XMLName: xml.Name{Space: "DAV:", Local: "getlastmodified"}, + InnerXML: nil, // Calculated during test. }, { XMLName: xml.Name{Space: "DAV:", Local: "supportedlock"}, InnerXML: []byte(lockEntry),