1
0
Fork 0
mirror of https://github.com/Luzifer/preserve.git synced 2024-12-20 09:41:18 +00:00

Fix: Error wrapping broke error check

Signed-off-by: Knut Ahlers <knut@ahlers.me>
This commit is contained in:
Knut Ahlers 2023-12-29 18:51:52 +01:00
parent 89607414fa
commit dda0c73eac
Signed by: luzifer
SSH key fingerprint: SHA256:/xtE5lCgiRDQr8SLxHMS92ZBlACmATUmF1crK16Ks4E

View file

@ -3,7 +3,9 @@ package main
import ( import (
"context" "context"
"encoding/base64" "encoding/base64"
"errors"
"fmt" "fmt"
"io/fs"
"net/http" "net/http"
"net/url" "net/url"
"os" "os"
@ -137,13 +139,13 @@ func handleCache(w http.ResponseWriter, r *http.Request, uri string, update bool
logger.Debug("Received request") logger.Debug("Received request")
metadata, err := store.LoadMeta(r.Context(), cachePath) 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") logrus.WithError(err).Error("loading meta")
http.Error(w, "accessing entry metadata", http.StatusInternalServerError) http.Error(w, "accessing entry metadata", http.StatusInternalServerError)
return return
} }
if update || os.IsNotExist(err) { if update || errors.Is(err, fs.ErrNotExist) {
logger.Debug("updating cache") logger.Debug("updating cache")
cacheHeader = "MISS" cacheHeader = "MISS"