Skip to content

Commit 7de9a8b

Browse files
committed
url.JoinPath
1 parent 9f6efb4 commit 7de9a8b

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

lib/httpapi/server.go

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import (
66
"fmt"
77
"log/slog"
88
"net/http"
9-
"path/filepath"
9+
"net/url"
1010
"sync"
1111
"time"
1212

@@ -322,5 +322,10 @@ func (s *Server) registerStaticFileRoutes() {
322322
}
323323

324324
func (s *Server) redirectToChat(w http.ResponseWriter, r *http.Request) {
325-
http.Redirect(w, r, filepath.Join(s.chatBasePath, "embed"), http.StatusTemporaryRedirect)
325+
rdir, err := url.JoinPath(s.chatBasePath, "embed")
326+
if err != nil {
327+
http.Error(w, "Failed to redirect", http.StatusInternalServerError)
328+
return
329+
}
330+
http.Redirect(w, r, rdir, http.StatusTemporaryRedirect)
326331
}

0 commit comments

Comments
 (0)