use existing mountpoint on auto accept

Signed-off-by: jkoberg <jkoberg@owncloud.com>
This commit is contained in:
jkoberg
2023-10-26 11:59:21 +02:00
parent 2bee588977
commit e8a3f28cf0
2 changed files with 16 additions and 3 deletions

View File

@@ -0,0 +1,5 @@
Bugfix: set existing mountpoint on auto accept
When already having a share for a specific resource, auto accept would use custom mountpoints which lead to other errors. Now auto-accept is using the existing mountpoint of a share.
https://github.com/owncloud/ocis/pull/7592

View File

@@ -162,11 +162,19 @@ func getMountpoint(ctx context.Context, itemid *provider.ResourceId, uid *user.U
// we need to sort the received shares by mount point in order to make things easier to evaluate.
base := path.Base(info.GetPath())
mount := base
var mountedShares []*collaboration.ReceivedShare
mountedShares := make([]*collaboration.ReceivedShare, 0, len(lrs.Shares))
for _, s := range lrs.Shares {
if !utils.ResourceIDEqual(s.Share.ResourceId, itemid) && s.State == collaboration.ShareState_SHARE_STATE_ACCEPTED {
mountedShares = append(mountedShares, s)
if s.State != collaboration.ShareState_SHARE_STATE_ACCEPTED {
// we don't care about unaccepted shares
continue
}
if utils.ResourceIDEqual(s.Share.ResourceId, itemid) {
// a share to the same resource already exists and is mounted
return s.MountPoint.Path, nil
}
mountedShares = append(mountedShares, s)
}
sort.Slice(mountedShares, func(i, j int) bool {