aboutsummaryrefslogtreecommitdiff
path: root/pkg/ext
diff options
context:
space:
mode:
authorGabriel A. Giovanini <mail@gabrielgio.me>2024-12-12 14:14:45 +0100
committerGabriel A. Giovanini <mail@gabrielgio.me>2024-12-12 14:14:45 +0100
commitdcc9a54fc8a1c52bb8cded28c4f445248bc597a6 (patch)
treef4a34e9fc92310efb41ca272a4f51d6c1193ec49 /pkg/ext
parentc5af9792973ec10eb37a7e4f47e8a16e95c62f60 (diff)
downloadcerrado-dcc9a54fc8a1c52bb8cded28c4f445248bc597a6.tar.gz
cerrado-dcc9a54fc8a1c52bb8cded28c4f445248bc597a6.tar.bz2
cerrado-dcc9a54fc8a1c52bb8cded28c4f445248bc597a6.zip
fix: Ignore error log for ErrNoCookie
When an unlogged user request the page it will always return ErrNoCookie.
Diffstat (limited to 'pkg/ext')
-rw-r--r--pkg/ext/auth.go5
1 files changed, 4 insertions, 1 deletions
diff --git a/pkg/ext/auth.go b/pkg/ext/auth.go
index b57e86a..304f4ad 100644
--- a/pkg/ext/auth.go
+++ b/pkg/ext/auth.go
@@ -3,6 +3,7 @@ package ext
import (
"context"
"encoding/base64"
+ "errors"
"log/slog"
"net/http"
)
@@ -24,7 +25,9 @@ func Authenticate(auth authService) func(next http.HandlerFunc) http.HandlerFunc
return func(w http.ResponseWriter, r *http.Request) {
cookie, err := r.Cookie("auth")
if err != nil {
- slog.Error("Error loading cookie", "error", err)
+ if !errors.Is(err, http.ErrNoCookie) {
+ slog.Error("Error loading cookie", "error", err)
+ }
next(w, r)
return
}