Skip to content

Commit

Permalink
fix 500 when open public link from deleted user
Browse files Browse the repository at this point in the history
  • Loading branch information
2403905 committed Nov 20, 2023
1 parent a5f1195 commit 8f8f6ce
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
6 changes: 6 additions & 0 deletions changelog/unreleased/fix-status-code.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Bugfix: Fix 500 when open public link

We fixed a bug that caused nil pointer and Error 500 when open public link from deleted user

https://github.com/cs3org/reva/pull/4351
https://github.com/owncloud/ocis/issues/7740
9 changes: 8 additions & 1 deletion pkg/auth/manager/publicshares/publicshares.go
Original file line number Diff line number Diff line change
Expand Up @@ -135,8 +135,15 @@ func (m *manager) Authenticate(ctx context.Context, token, secret string) (*user
getUserResponse, err := gwConn.GetUser(ctx, &userprovider.GetUserRequest{
UserId: publicShareResponse.GetShare().GetCreator(),
})
if err != nil {
switch {
case err != nil:
return nil, nil, err
case getUserResponse.GetStatus().GetCode() == rpcv1beta1.Code_CODE_NOT_FOUND:
return nil, nil, errtypes.NotFound(getUserResponse.GetStatus().GetMessage())
case getUserResponse.GetStatus().GetCode() == rpcv1beta1.Code_CODE_PERMISSION_DENIED:
return nil, nil, errtypes.InvalidCredentials(getUserResponse.GetStatus().GetMessage())
case getUserResponse.GetStatus().GetCode() != rpcv1beta1.Code_CODE_OK:
return nil, nil, errtypes.InternalError(getUserResponse.GetStatus().GetMessage())
}
owner = getUserResponse.GetUser()
}
Expand Down

0 comments on commit 8f8f6ce

Please sign in to comment.