From 7b7ebc571104729fbd26f67f2bf1ede08a63010d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Roth?= Date: Tue, 2 Jan 2024 14:58:16 +0100 Subject: [PATCH] s3: fix FileExists not working in some go versions --- s3/public.go | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/s3/public.go b/s3/public.go index 8c682a66..fad98e90 100644 --- a/s3/public.go +++ b/s3/public.go @@ -491,6 +491,17 @@ func (storage *PublishedStorage) FileExists(path string) (bool, error) { return false, nil } + // falback in case the above condidition fails + var opErr *smithy.OperationError + if errors.As(err, &opErr) { + var ae smithy.APIError + if errors.As(err, &ae) { + if (ae.ErrorCode() == "NotFound") { + return false, nil + } + } + } + return false, err }