Skip to content

fix: list shares, handle reva errors more gracefully - #11245

Merged
mklos-kw merged 1 commit into
masterfrom
feat/list-shares
May 9, 2025
Merged

mklos-kw merged 1 commit into
masterfrom
feat/list-shares

Conversation

@mklos-kw

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

Copy link
Copy Markdown
Member

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:

@update-docs

update-docs Bot commented Apr 17, 2025

Copy link
Copy Markdown

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
}, driveItems)
if err != nil {
s.logger.Error().Err(err).Str("storageID", itemID.GetStorageId()).Msg("listPublicShares failed")
if err != nil && !strings.Contains(err.Error(), errtypes.ERR_ALREADY_EXISTS) {

@mklos-kw mklos-kw Apr 23, 2025 •

Copy link
Copy Markdown
Member Author

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
}, 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
Copy Markdown
Contributor

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
Copy Markdown
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
@sonarqubecloud

Copy link
Copy Markdown

@mklos-kw
mklos-kw merged commit 7150688 into master May 9, 2025
@github-actions
github-actions Bot deleted the feat/list-shares branch September 25, 2025 00:24
butonic added a commit to opencloud-eu/opencloud that referenced this pull request Nov 13, 2026
When the public share manager cannot access its metadata space, e.g.
after an upgrade, listing public shares fails with an already exists
error and the whole permissions request ended in a 500. The space
members dialog in web then just keeps spinning.

We now log a warning, skip the link permissions and still return the
user and space permissions.

Our reva currently replaces the original error with a generic "error
listing public shares", so this only takes effect together with the
port of `owncloud/reva#264`, which passes the error message through.

ported from `owncloud/ocis#11245`

Assisted-by: Claude Code:claude-opus-5-5
Signed-off-by: Jörn Friedrich Dreyer <[email protected]>
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

3 participants