Skip to content

Commit de8cea1

Browse files
authored
Merge pull request #4843 from fschade/persist-updated-share
fix: persist updated share
2 parents 5fd1e89 + db528d3 commit de8cea1

File tree

2 files changed

+16
-4
lines changed

2 files changed

+16
-4
lines changed

changelog/unreleased/allow-update-ocm-shares.md

+1
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,6 @@ Bugfix: Allow update of ocm shares
22

33
We fixed a bug that prevented ocm shares to be updated or removed.
44

5+
https://github.com/cs3org/reva/pull/4843/
56
https://github.com/cs3org/reva/pull/4840/
67
https://github.com/owncloud/ocis/issues/9926

pkg/ocm/share/repository/json/json.go

+15-4
Original file line numberDiff line numberDiff line change
@@ -31,14 +31,15 @@ import (
3131
ocm "github.com/cs3org/go-cs3apis/cs3/sharing/ocm/v1beta1"
3232
provider "github.com/cs3org/go-cs3apis/cs3/storage/provider/v1beta1"
3333
typespb "github.com/cs3org/go-cs3apis/cs3/types/v1beta1"
34+
"github.com/google/uuid"
35+
"github.com/pkg/errors"
36+
"google.golang.org/genproto/protobuf/field_mask"
37+
3438
"github.com/cs3org/reva/v2/pkg/errtypes"
3539
"github.com/cs3org/reva/v2/pkg/ocm/share"
3640
"github.com/cs3org/reva/v2/pkg/ocm/share/repository/registry"
3741
"github.com/cs3org/reva/v2/pkg/utils"
3842
"github.com/cs3org/reva/v2/pkg/utils/cfg"
39-
"github.com/google/uuid"
40-
"github.com/pkg/errors"
41-
"google.golang.org/genproto/protobuf/field_mask"
4243
)
4344

4445
func init() {
@@ -466,7 +467,17 @@ func (m *mgr) UpdateShare(ctx context.Context, user *userpb.User, ref *ocm.Share
466467
}
467468
}
468469

469-
return s, nil
470+
clone, err := cloneShare(s)
471+
if err != nil {
472+
return nil, err
473+
}
474+
m.model.Shares[s.Id.OpaqueId] = clone
475+
476+
if err := m.save(); err != nil {
477+
return nil, errors.Wrap(err, "error saving share")
478+
}
479+
480+
return clone, nil
470481
}
471482
}
472483
}

0 commit comments

Comments
 (0)