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:
parent
89607414fa
commit
dda0c73eac
1 changed files with 4 additions and 2 deletions
6
main.go
6
main.go
|
@ -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"
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue