Skip to content

Commit 720b32a

Browse files
committed
all: fix trim behavior
1 parent 4bdba9a commit 720b32a

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

short.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -123,11 +123,10 @@ func (s *server) sHandler(w http.ResponseWriter, r *http.Request) {
123123
// throw 50x. The server should be able to identify the issue.
124124
log.Printf("stats err: %v\n", err)
125125
// Use 307 redirect to 404 page
126-
http.Redirect(w, r, conf.Host+"/404.html", http.StatusTemporaryRedirect)
126+
http.Redirect(w, r, "/404.html", http.StatusTemporaryRedirect)
127127
}
128128
}()
129-
130-
alias := strings.TrimLeft(r.URL.Path, conf.S.Prefix)
129+
alias := strings.TrimPrefix(r.URL.Path, conf.S.Prefix)
131130
if alias == "" {
132131
err = s.stats(ctx, w)
133132
return

0 commit comments

Comments
 (0)