From dda0c73eac35bb32cadd42db99faddec6eaffb11 Mon Sep 17 00:00:00 2001 From: Knut Ahlers Date: Fri, 29 Dec 2023 18:51:52 +0100 Subject: [PATCH] Fix: Error wrapping broke error check Signed-off-by: Knut Ahlers --- main.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/main.go b/main.go index f5cb6ba..b1db1ec 100644 --- a/main.go +++ b/main.go @@ -3,7 +3,9 @@ package main import ( "context" "encoding/base64" + "errors" "fmt" + "io/fs" "net/http" "net/url" "os" @@ -137,13 +139,13 @@ func handleCache(w http.ResponseWriter, r *http.Request, uri string, update bool logger.Debug("Received request") metadata, err := store.LoadMeta(r.Context(), cachePath) - if err != nil && !os.IsNotExist(err) { + if err != nil && !errors.Is(err, fs.ErrNotExist) { logrus.WithError(err).Error("loading meta") http.Error(w, "accessing entry metadata", http.StatusInternalServerError) return } - if update || os.IsNotExist(err) { + if update || errors.Is(err, fs.ErrNotExist) { logger.Debug("updating cache") cacheHeader = "MISS"