From df08fc980ac3f710a67bd692b8126eb978699d5b Mon Sep 17 00:00:00 2001 From: Derrick Hammer Date: Wed, 17 May 2023 13:33:22 -0400 Subject: [PATCH] fix: add a check for a 500 error --- service/files/files.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/service/files/files.go b/service/files/files.go index d490c1d..689f555 100644 --- a/service/files/files.go +++ b/service/files/files.go @@ -54,6 +54,10 @@ func Upload(r io.ReadSeeker, size int64) (model.Upload, error) { return upload, err } + if objectExistsResult.StatusCode() == 500 { + return upload, errors.New(fmt.Sprintf("error fetching file: %s", objectExistsResult.String())) + } + if objectExistsResult.StatusCode() != 404 { return upload, errors.New("file already exists in network, but missing in database") }