Merge pull request #10738 from owncloud/webdav_format_lastmodified

fix: change the format to RFC1123 to follow the specs
This commit is contained in:
kobergj
2024-12-10 12:27:00 +01:00
committed by GitHub
3 changed files with 12 additions and 2 deletions

View File

@@ -0,0 +1,5 @@
Bugfix: GetLastModified property in the REPORT response will use RFC1123 format
This will follow the standard and will also match the format of the same property in the PROPFIND response
https://github.com/owncloud/ocis/pull/10738

View File

@@ -5,4 +5,9 @@ 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
// Format copied from internal package https://github.com/cs3org/reva/blob/edge/internal/http/services/owncloud/ocdav/net/net.go.
// It's needed to match the times shown in PROPFIND and REPORT requests.
RFC1123 = "Mon, 02 Jan 2006 15:04:05 GMT"
)

View File

@@ -9,7 +9,6 @@ import (
"path"
"strconv"
"strings"
"time"
provider "github.com/cs3org/go-cs3apis/cs3/storage/provider/v1beta1"
merrors "go-micro.dev/v4/errors"
@@ -21,6 +20,7 @@ import (
"github.com/cs3org/reva/v2/pkg/utils"
searchmsg "github.com/owncloud/ocis/v2/protogen/gen/ocis/messages/search/v0"
searchsvc "github.com/owncloud/ocis/v2/protogen/gen/ocis/services/search/v0"
"github.com/owncloud/ocis/v2/services/webdav/pkg/constants"
"github.com/owncloud/ocis/v2/services/webdav/pkg/net"
"github.com/owncloud/ocis/v2/services/webdav/pkg/prop"
"github.com/owncloud/ocis/v2/services/webdav/pkg/propfind"
@@ -192,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(time.RFC3339)))
propstatOK.Prop = append(propstatOK.Prop, prop.Escaped("d:getlastmodified", match.Entity.LastModifiedTime.AsTime().Format(constants.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))