Skip to content

Commit

Permalink
Merge pull request #4843 from fschade/persist-updated-share
Browse files Browse the repository at this point in the history
fix: persist updated share
  • Loading branch information
dragonchaser authored Sep 11, 2024
2 parents 5fd1e89 + db528d3 commit de8cea1
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
1 change: 1 addition & 0 deletions changelog/unreleased/allow-update-ocm-shares.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@ Bugfix: Allow update of ocm shares

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

https://github.com/cs3org/reva/pull/4843/
https://github.com/cs3org/reva/pull/4840/
https://github.com/owncloud/ocis/issues/9926
19 changes: 15 additions & 4 deletions pkg/ocm/share/repository/json/json.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,15 @@ import (
ocm "github.com/cs3org/go-cs3apis/cs3/sharing/ocm/v1beta1"
provider "github.com/cs3org/go-cs3apis/cs3/storage/provider/v1beta1"
typespb "github.com/cs3org/go-cs3apis/cs3/types/v1beta1"
"github.com/google/uuid"
"github.com/pkg/errors"
"google.golang.org/genproto/protobuf/field_mask"

"github.com/cs3org/reva/v2/pkg/errtypes"
"github.com/cs3org/reva/v2/pkg/ocm/share"
"github.com/cs3org/reva/v2/pkg/ocm/share/repository/registry"
"github.com/cs3org/reva/v2/pkg/utils"
"github.com/cs3org/reva/v2/pkg/utils/cfg"
"github.com/google/uuid"
"github.com/pkg/errors"
"google.golang.org/genproto/protobuf/field_mask"
)

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

return s, nil
clone, err := cloneShare(s)
if err != nil {
return nil, err
}
m.model.Shares[s.Id.OpaqueId] = clone

if err := m.save(); err != nil {
return nil, errors.Wrap(err, "error saving share")
}

return clone, nil
}
}
}
Expand Down

0 comments on commit de8cea1

Please sign in to comment.