From 5e0304fb546d8130d23cb1b16998d63e0b4e3316 Mon Sep 17 00:00:00 2001 From: Chris Schinnerl Date: Tue, 3 Oct 2023 10:54:51 +0200 Subject: [PATCH] fix superfluous header being returned on failed download --- gofakes3.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/gofakes3.go b/gofakes3.go index 2bbea67..98e4dc5 100644 --- a/gofakes3.go +++ b/gofakes3.go @@ -515,9 +515,11 @@ func (g *GoFakeS3) getObject( obj.Range.writeHeader(obj.Size, w) if _, err := io.Copy(w, obj.Contents); err != nil { - return err + // Log this failure but return 'nil'. We have already started sending + // data so we can't send an error response anymore anyway. + g.log.Print(LogErr, "error copying object contents", err) + return nil } - return nil }