-
Notifications
You must be signed in to change notification settings - Fork 201
fix: list shares, handle reva errors more gracefully #11245
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
Thanks for opening this pull request! The maintainers of this repository would appreciate it if you would create a changelog item based on your changes. |
c0d5c6c
to
9c73b2a
Compare
s.logger.Error().Err(err).Str("storageID", itemID.GetStorageId()).Msg("listPublicShares failed") | ||
if err != nil && !strings.Contains(err.Error(), errtypes.ERR_ALREADY_EXISTS) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Comparing error by string, because the errtype
from reva does not pass through error
interface.
Alternatives to change the error type in the API or errtype in reva would have much wider refactoring.
6c36377
to
8fbe998
Compare
06b2967
to
5e79548
Compare
d38d9a6
to
1fbb082
Compare
@@ -462,8 +464,8 @@ func (s DriveItemPermissionsService) ListPermissions(ctx context.Context, itemID | |||
driveItems, err = s.listPublicShares(ctx, []*link.ListPublicSharesRequest_Filter{ | |||
publicshare.ResourceIDFilter(itemID), | |||
}, driveItems) | |||
if err != nil { | |||
s.logger.Error().Err(err).Str("storageID", itemID.GetStorageId()).Msg("listPublicShares failed") | |||
s.logger.Error().Err(err).Str("storageID", itemID.GetStorageId()).Msg("listPublicShares failed") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We want the log inside the if-clause don't we?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, fixed, thank you!
1fbb082
to
c8c0996
Compare
6b3d7dd
to
012c727
Compare
|
Description
Handle gracefully the error mentioned by the issues. Unblock the space members API by recognizing the reva 'AlreadyExists'. Return HTTP OK 200 with remaining shares instead of HTTP Internal Server Error 5XX.
Related Issue
Motivation and Context
How Has This Been Tested?
Screenshots (if appropriate):
Types of changes
Checklist: