Skip to content

Commit

Permalink
fix: persist updated share
Browse files Browse the repository at this point in the history
  • Loading branch information
fschade committed Sep 11, 2024
1 parent 5fd1e89 commit db528d3
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 db528d3

Please sign in to comment.