mirror of
https://github.com/Luzifer/preserve.git
synced 2024-12-20 01:31:17 +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 (
|
||||
"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"
|
||||
|
||||
|
|
Loading…
Reference in a new issue