Skip to content

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

mklos-kw
Copy link
Member

@mklos-kw mklos-kw commented Apr 17, 2025

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

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Technical debt
  • Tests only (no source changes)

Checklist:

  • Code changes
  • Unit tests added
  • Acceptance tests added
  • Documentation ticket raised:

Copy link

update-docs bot commented Apr 17, 2025

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.

@mklos-kw mklos-kw force-pushed the feat/list-shares branch 2 times, most recently from c0d5c6c to 9c73b2a Compare April 23, 2025 06:22
s.logger.Error().Err(err).Str("storageID", itemID.GetStorageId()).Msg("listPublicShares failed")
if err != nil && !strings.Contains(err.Error(), errtypes.ERR_ALREADY_EXISTS) {
Copy link
Member Author

@mklos-kw mklos-kw Apr 23, 2025

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.

@mklos-kw mklos-kw force-pushed the feat/list-shares branch 2 times, most recently from 6c36377 to 8fbe998 Compare April 23, 2025 06:34
@mklos-kw mklos-kw force-pushed the feat/list-shares branch 7 times, most recently from 06b2967 to 5e79548 Compare April 24, 2025 08:23
@mklos-kw mklos-kw marked this pull request as ready for review April 30, 2025 11:31
@mklos-kw mklos-kw requested a review from 2403905 April 30, 2025 11:31
@@ -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")
Copy link
Collaborator

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?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, fixed, thank you!

@mklos-kw mklos-kw force-pushed the feat/list-shares branch 2 times, most recently from 6b3d7dd to 012c727 Compare April 30, 2025 21:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Can't view or edit space members after upgrade
2 participants