Skip to content

Commit

Permalink
Do not swallow 'not found' errors in Stat
Browse files Browse the repository at this point in the history
Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>
  • Loading branch information
butonic committed Aug 26, 2020
1 parent 739d806 commit 3482177
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
5 changes: 5 additions & 0 deletions changelog/unreleased/do-not-swallow-not-found-stat.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Bugfix: Do not swallow 'not found' errors in Stat

Webdav needs to determine if a file exists to return 204 or 201 response codes. When stating a non existing resource the NOT_FOUND code was replaced with an INTERNAL error code. This PR passes on a NOT_FOUND status code.

https://github.com/cs3org/reva/pull/1124
5 changes: 5 additions & 0 deletions internal/grpc/services/gateway/storageprovider.go
Original file line number Diff line number Diff line change
Expand Up @@ -1051,6 +1051,11 @@ func (s *svc) Stat(ctx context.Context, req *provider.StatRequest) (*provider.St
}, nil
}
if res.Status.Code != rpc.Code_CODE_OK {
if res.Status.Code == rpc.Code_CODE_NOT_FOUND {
return &provider.StatResponse{
Status: status.NewNotFound(ctx, "gateway: file not found"),
}, nil
}
err := status.NewErrorFromCode(res.Status.Code, "gateway")
log.Err(err).Msg("gateway: error stating")
return &provider.StatResponse{
Expand Down

0 comments on commit 3482177

Please sign in to comment.