Skip to content

Commit

Permalink
Don't use os.IsNotExist (#6)
Browse files Browse the repository at this point in the history
  • Loading branch information
ypdn authored Feb 19, 2024
1 parent 0bd452f commit 8e79949
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions hashfs.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ package hashfs
import (
"crypto/sha256"
"encoding/hex"
"errors"
"fmt"
"io"
"io/fs"
"net/http"
"os"
"path"
"regexp"
"strconv"
Expand Down Expand Up @@ -173,7 +173,7 @@ func (h *fsHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {

// Read file from attached file system.
f, hash, err := h.fsys.open(filename)
if os.IsNotExist(err) {
if errors.Is(err, fs.ErrNotExist) {
http.Error(w, "404 page not found", http.StatusNotFound)
return
} else if err != nil {
Expand Down

0 comments on commit 8e79949

Please sign in to comment.