Skip to content

Commit

Permalink
Merge pull request #7592 from kobergj/FixMountpointOnAutoAccept
Browse files Browse the repository at this point in the history
Reuse existing mountpoints on auto accept
  • Loading branch information
kobergj committed Oct 26, 2023
2 parents 2bee588 + e8a3f28 commit 2bd85b7
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
5 changes: 5 additions & 0 deletions changelog/unreleased/fix-mountpoint-autoaccept.md
Original file line number Diff line number Diff line change
@@ -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
14 changes: 11 additions & 3 deletions services/frontend/pkg/command/events.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 2bd85b7

Please sign in to comment.