1
0
mirror of https://git.sr.ht/~adnano/go-gemini synced 2025-05-01 19:05:25 +02:00

fs: Avoid equality check if lengths don't match

This commit is contained in:
adnano 2021-04-21 12:48:16 -04:00
parent fed90d2759
commit 5662c5a26c

2
fs.go

@ -67,7 +67,7 @@ func (fsys fileServer) ServeGemini(ctx context.Context, w ResponseWriter, r *Req
if target != "/" {
target += "/"
}
if r.URL.Path != target {
if len(r.URL.Path) != len(target) || r.URL.Path != target {
w.WriteHeader(StatusPermanentRedirect, target)
return
}