Skip to content

Commit

Permalink
fix custom server return URL decoding
Browse files Browse the repository at this point in the history
Previously the form escaped the return URL twice,
preventing it from working.
  • Loading branch information
paskal committed Jan 14, 2023
1 parent c3360c6 commit fb9d0aa
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion provider/custom_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ func (c *CustomServer) handleAuthorize(w http.ResponseWriter, r *http.Request) {
return
}

formData := struct{ Query string }{Query: r.URL.RawQuery}
formData := struct{ Query template.URL }{Query: template.URL(r.URL.RawQuery)} //nolint:gosec // query is safe

if err := userLoginTmpl.Execute(w, formData); err != nil {
c.Logf("[WARN] can't write, %s", err)
Expand Down
2 changes: 1 addition & 1 deletion provider/dev_provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ func (d *DevAuthServer) Run(ctx context.Context) { // nolint (gocyclo)

// first time it will be called without username and will ask for one
if !d.Automatic && (r.ParseForm() != nil || r.Form.Get("username") == "") {
formData := struct{ Query template.URL }{Query: template.URL(r.URL.RawQuery)} //nolint:gosec // query is safes
formData := struct{ Query template.URL }{Query: template.URL(r.URL.RawQuery)} //nolint:gosec // query is safe
if err = userFormTmpl.Execute(w, formData); err != nil {
d.Logf("[WARN] can't write, %s", err)
}
Expand Down

0 comments on commit fb9d0aa

Please sign in to comment.