diff --git a/cmd/revad/svcs/httpsvcs/ocdavsvc/options.go b/cmd/revad/svcs/httpsvcs/ocdavsvc/options.go index b7a48e1023..1b9225d82a 100644 --- a/cmd/revad/svcs/httpsvcs/ocdavsvc/options.go +++ b/cmd/revad/svcs/httpsvcs/ocdavsvc/options.go @@ -33,7 +33,7 @@ func (s *svc) doOptions(w http.ResponseWriter, r *http.Request) { w.Header().Set("Access-Control-Allow-Origin", "*") w.Header().Set("Access-Control-Allow-Credentials", "true") w.Header().Set("Access-Control-Allow-Methods", allow) - w.Header().Set("Access-Control-Allow-Headers", "Authorization, Content-Type, Depth, Ocs-Apirequest, If-None-Match, Destination") + w.Header().Set("Access-Control-Allow-Headers", "Authorization, Content-Type, Depth, Ocs-Apirequest, If-Match, If-None-Match, Destination") w.Header().Set("Content-Type", "application/xml") w.Header().Set("Allow", allow) w.Header().Set("DAV", "1, 2") diff --git a/pkg/storage/fs/owncloud/owncloud.go b/pkg/storage/fs/owncloud/owncloud.go index 6b3a2407d6..15246bf77e 100644 --- a/pkg/storage/fs/owncloud/owncloud.go +++ b/pkg/storage/fs/owncloud/owncloud.go @@ -957,13 +957,13 @@ func (fs *ocFS) Upload(ctx context.Context, ref *storageproviderv0alphapb.Refere return errors.Wrap(err, "ocFS: error writing to tmp file "+tmp.Name()) } - // TODO(jfd): copy attributes of existing file to tmp file? - if err := fs.copyMD(np, tmp.Name()); err != nil { - return errors.Wrap(err, "ocFS: error copying metadata from "+np+" to "+tmp.Name()) - } - - // create revision if destination exists - if _, err := os.Stat(np); err != nil { + // if destination exists + if _, err := os.Stat(np); err == nil { + // copy attributes of existing file to tmp file + if err := fs.copyMD(np, tmp.Name()); err != nil { + return errors.Wrap(err, "ocFS: error copying metadata from "+np+" to "+tmp.Name()) + } + // create revision if err := fs.archiveRevision(ctx, np); err != nil { return err }