From 4e509605f7a813b63ba7f65f021a13759a50a2e8 Mon Sep 17 00:00:00 2001 From: Roman Perekhod Date: Mon, 9 Dec 2024 15:33:43 +0100 Subject: [PATCH] add the time formater to webdav --- services/webdav/pkg/constants/constants.go | 3 +++ services/webdav/pkg/service/v0/search.go | 3 ++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/services/webdav/pkg/constants/constants.go b/services/webdav/pkg/constants/constants.go index 3456ab830..19c520a64 100644 --- a/services/webdav/pkg/constants/constants.go +++ b/services/webdav/pkg/constants/constants.go @@ -5,4 +5,7 @@ type contextKey int const ( ContextKeyID contextKey = iota ContextKeyPath + + // RFC1123 time that mimics oc10. time.RFC1123 would end in "UTC", see https://github.com/golang/go/issues/13781 + RFC1123 = "Mon, 02 Jan 2006 15:04:05 GMT" ) diff --git a/services/webdav/pkg/service/v0/search.go b/services/webdav/pkg/service/v0/search.go index 571448efc..93697e683 100644 --- a/services/webdav/pkg/service/v0/search.go +++ b/services/webdav/pkg/service/v0/search.go @@ -9,6 +9,7 @@ import ( "path" "strconv" "strings" + "time" provider "github.com/cs3org/go-cs3apis/cs3/storage/provider/v1beta1" merrors "go-micro.dev/v4/errors" @@ -191,7 +192,7 @@ func matchToPropResponse(ctx context.Context, match *searchmsg.Match) (*propfind }))) } propstatOK.Prop = append(propstatOK.Prop, prop.Escaped("oc:name", match.Entity.Name)) - propstatOK.Prop = append(propstatOK.Prop, prop.Escaped("d:getlastmodified", match.Entity.LastModifiedTime.AsTime().Format(net.RFC1123))) + propstatOK.Prop = append(propstatOK.Prop, prop.Escaped("d:getlastmodified", match.Entity.LastModifiedTime.AsTime().Format(time.RFC1123))) propstatOK.Prop = append(propstatOK.Prop, prop.Escaped("d:getcontenttype", match.Entity.MimeType)) propstatOK.Prop = append(propstatOK.Prop, prop.Escaped("oc:permissions", match.Entity.Permissions)) propstatOK.Prop = append(propstatOK.Prop, prop.Escaped("oc:highlights", match.Entity.Highlights))