aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdnan Maolood <[email protected]>2021-04-21 12:48:16 -0400
committerAdnan Maolood <[email protected]>2021-04-21 12:48:27 -0400
commit1170e007d464f5aa091264c0d22c05921bd39e77 (patch)
tree5afbe485a1a086b2fcb927f357861540b1a1ebe1
parentfs: Improve redirect behavior (diff)
downloadarchived-go-gemini-0.2.1.tar.xz
archived-go-gemini-0.2.1.zip
fs: Avoid equality check if lengths don't matchv0.2.1
-rw-r--r--fs.go2
1 files changed, 1 insertions, 1 deletions
diff --git a/fs.go b/fs.go
index c4fba24..7a73150 100644
--- a/fs.go
+++ b/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
}