From 34821771021ec5379e39cce5aecf542da072983c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rn=20Friedrich=20Dreyer?= Date: Wed, 26 Aug 2020 14:58:51 +0200 Subject: [PATCH] Do not swallow 'not found' errors in Stat MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Jörn Friedrich Dreyer --- changelog/unreleased/do-not-swallow-not-found-stat.md | 5 +++++ internal/grpc/services/gateway/storageprovider.go | 5 +++++ 2 files changed, 10 insertions(+) create mode 100644 changelog/unreleased/do-not-swallow-not-found-stat.md diff --git a/changelog/unreleased/do-not-swallow-not-found-stat.md b/changelog/unreleased/do-not-swallow-not-found-stat.md new file mode 100644 index 00000000000..eacecc17bde --- /dev/null +++ b/changelog/unreleased/do-not-swallow-not-found-stat.md @@ -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 diff --git a/internal/grpc/services/gateway/storageprovider.go b/internal/grpc/services/gateway/storageprovider.go index a0304b81f46..e3924c29c1b 100644 --- a/internal/grpc/services/gateway/storageprovider.go +++ b/internal/grpc/services/gateway/storageprovider.go @@ -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{