From ff16e4c3db1c6d00be803b0ad4d2aa81dd1b3027 Mon Sep 17 00:00:00 2001 From: a Date: Tue, 7 Nov 2023 03:47:12 -0600 Subject: [PATCH] fix(storage): handle pathnotfound for walk call (#2006) Signed-off-by: a --- pkg/storage/imagestore/imagestore.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/pkg/storage/imagestore/imagestore.go b/pkg/storage/imagestore/imagestore.go index a388d9cd..57a845f7 100644 --- a/pkg/storage/imagestore/imagestore.go +++ b/pkg/storage/imagestore/imagestore.go @@ -392,6 +392,14 @@ func (is *ImageStore) GetNextRepository(repo string) (string, error) { driverErr := &driver.Error{} + // some s3 implementations (eg, digitalocean spaces) will return pathnotfounderror for walk but not list + // therefore, we must also catch that error here. + if errors.As(err, &driver.PathNotFoundError{}) { + is.log.Debug().Msg("empty rootDir") + + return "", nil + } + if errors.Is(err, io.EOF) || (errors.As(err, driverErr) && errors.Is(driverErr.Enclosed, io.EOF)) { return store, nil