From 2b4c15c1f772cba47421d87ca7ee6eea7bba8713 Mon Sep 17 00:00:00 2001 From: Patrick Pacher Date: Tue, 11 Oct 2022 11:50:47 +0200 Subject: [PATCH] Fix error handling in LoadIndexes --- updater/storage.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/updater/storage.go b/updater/storage.go index cfae4cf..e8ceca1 100644 --- a/updater/storage.go +++ b/updater/storage.go @@ -4,6 +4,7 @@ import ( "context" "errors" "fmt" + "io/fs" "net/http" "os" "path/filepath" @@ -102,7 +103,7 @@ func (reg *ResourceRegistry) LoadIndexes(ctx context.Context) error { } else if reg.Online { // try to download the index file if a local disk version // does not exist or we don't have permission to read it. - if os.IsNotExist(err) || os.IsPermission(err) { + if errors.Is(err, fs.ErrNotExist) || errors.Is(err, fs.ErrPermission) { err = reg.downloadIndex(ctx, client, idx) } }