mirror of
https://github.com/opencloud-eu/opencloud.git
synced 2026-01-06 20:29:54 -06:00
Merge pull request #10243 from owncloud/continue-listing-shares-on-error
continue listing shares on error
This commit is contained in:
5
changelog/unreleased/continue-listing-shares-on-error.md
Normal file
5
changelog/unreleased/continue-listing-shares-on-error.md
Normal file
@@ -0,0 +1,5 @@
|
||||
Bugfix: Continue listing shares on error
|
||||
|
||||
We now continue listing received shares when one of the shares cannot be statted or converted to a driveItem.
|
||||
|
||||
https://github.com/owncloud/ocis/pull/10243
|
||||
@@ -55,7 +55,7 @@ func (g Graph) listSharedWithMe(ctx context.Context) ([]libregraph.DriveItem, er
|
||||
}
|
||||
ocmDriveItems, err := cs3ReceivedOCMSharesToDriveItems(ctx, g.logger, gatewayClient, g.identityCache, listReceivedOCMSharesResponse.GetShares(), availableRoles)
|
||||
if err != nil {
|
||||
g.logger.Error().Err(err).Msg("could not convert received shares to drive items")
|
||||
g.logger.Error().Err(err).Msg("could not convert received ocm shares to drive items")
|
||||
return nil, err
|
||||
}
|
||||
driveItems = append(driveItems, ocmDriveItems...)
|
||||
|
||||
@@ -3,7 +3,6 @@ package svc
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"io"
|
||||
"net/http"
|
||||
"reflect"
|
||||
@@ -203,23 +202,21 @@ func cs3ReceivedSharesToDriveItems(ctx context.Context,
|
||||
},
|
||||
})
|
||||
|
||||
var errCode errorcode.Error
|
||||
errors.As(errorcode.FromCS3Status(shareStat.GetStatus(), err), &errCode)
|
||||
|
||||
switch {
|
||||
// skip ItemNotFound shares, they might have been deleted in the meantime or orphans.
|
||||
case errCode.GetCode() == errorcode.ItemNotFound:
|
||||
if err := errorcode.FromCS3Status(shareStat.GetStatus(), err); err != nil {
|
||||
logger.Debug().Err(err).
|
||||
Str("shareid", receivedShares[0].GetShare().GetId().GetOpaqueId()).
|
||||
Str("resourceid", storagespace.FormatResourceID(receivedShares[0].GetShare().GetResourceId())).
|
||||
Msg("could not stat received share, skipping")
|
||||
return nil
|
||||
case err == nil:
|
||||
break
|
||||
default:
|
||||
logger.Error().Err(errCode).Msg("could not stat")
|
||||
return errCode
|
||||
}
|
||||
|
||||
driveItem, err := fillDriveItemPropertiesFromReceivedShare(ctx, logger, identityCache, receivedShares, shareStat.GetInfo(), availableRoles)
|
||||
if err != nil {
|
||||
return err
|
||||
logger.Debug().Err(err).
|
||||
Str("shareid", receivedShares[0].GetShare().GetId().GetOpaqueId()).
|
||||
Str("resourceid", storagespace.FormatResourceID(receivedShares[0].GetShare().GetResourceId())).
|
||||
Msg("could not fill drive item properties from received share, skipping")
|
||||
return nil
|
||||
}
|
||||
|
||||
if !driveItem.HasUIHidden() {
|
||||
@@ -553,23 +550,21 @@ func cs3ReceivedOCMSharesToDriveItems(ctx context.Context,
|
||||
},
|
||||
})
|
||||
|
||||
var errCode errorcode.Error
|
||||
errors.As(errorcode.FromCS3Status(shareStat.GetStatus(), err), &errCode)
|
||||
|
||||
switch {
|
||||
// skip ItemNotFound shares, they might have been deleted in the meantime or orphans.
|
||||
case errCode.GetCode() == errorcode.ItemNotFound:
|
||||
if err := errorcode.FromCS3Status(shareStat.GetStatus(), err); err != nil {
|
||||
logger.Debug().Err(err).
|
||||
Str("shareid", receivedShares[0].GetId().GetOpaqueId()).
|
||||
Str("remoteshareid", receivedShares[0].GetRemoteShareId()).
|
||||
Msg("could not stat received ocm share, skipping")
|
||||
return nil
|
||||
case err == nil:
|
||||
break
|
||||
default:
|
||||
logger.Error().Err(errCode).Msg("could not stat")
|
||||
return errCode
|
||||
}
|
||||
|
||||
driveItem, err := fillDriveItemPropertiesFromReceivedOCMShare(ctx, logger, identityCache, receivedShares, shareStat.GetInfo(), availableRoles)
|
||||
if err != nil {
|
||||
return err
|
||||
logger.Debug().Err(err).
|
||||
Str("shareid", receivedShares[0].GetId().GetOpaqueId()).
|
||||
Str("remoteshareid", receivedShares[0].GetRemoteShareId()).
|
||||
Msg("could not fill drive item properties from received ocm share, skipping")
|
||||
return nil
|
||||
}
|
||||
|
||||
if !driveItem.HasUIHidden() {
|
||||
|
||||
Reference in New Issue
Block a user