From 37c298713280dfb8a03cc2fbee5f029fbfcc792c Mon Sep 17 00:00:00 2001 From: Andrej Shadura Date: Thu, 2 Jul 2020 18:09:41 +0200 Subject: [PATCH] Pass the HTTP 416 code back from the proxy The HTTP 416 code is not an error but a legitimate response to an attempt to re-get a completely downloaded file. The code to handle this HTTP code is structured in a way to allow more codes to be added if necessary. Signed-off-by: Andrej Shadura --- internal/controllers/s3-error.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/internal/controllers/s3-error.go b/internal/controllers/s3-error.go index 9fda7fe..680a7b1 100644 --- a/internal/controllers/s3-error.go +++ b/internal/controllers/s3-error.go @@ -8,6 +8,12 @@ import ( ) func toHTTPError(err error) (int, string) { + if rerr, ok := err.(awserr.RequestFailure); ok { + switch rerr.StatusCode() { + case http.StatusRequestedRangeNotSatisfiable: + return rerr.StatusCode(), rerr.Message() + } + } if aerr, ok := err.(awserr.Error); ok { switch aerr.Code() { case s3.ErrCodeNoSuchBucket, s3.ErrCodeNoSuchKey: