Skip to content

Commit

Permalink
cmd/relui: actually fix publishing
Browse files Browse the repository at this point in the history
I got the arguments to TrimPrefix backward, but more importantly,
u.Query() returns a temporary copy.

For golang/go#51797.

Change-Id: I37a9df2adf47f1d72236d02761989d62e9991fc7
Reviewed-on: https://go-review.googlesource.com/c/build/+/411064
Reviewed-by: Cherry Mui <[email protected]>
TryBot-Result: Gopher Robot <[email protected]>
Run-TryBot: Heschi Kreinick <[email protected]>
Reviewed-by: Dmitri Shuralyov <[email protected]>
Auto-Submit: Heschi Kreinick <[email protected]>
  • Loading branch information
heschi authored and gopherbot committed Jun 10, 2022
1 parent 09064db commit bf85695
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions cmd/relui/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -183,8 +183,10 @@ func publishFile(uploadURL string, auth buildlet.UserPass, f *relui.WebsiteFile)
if err != nil {
return fmt.Errorf("invalid website upload URL %q: %v", *websiteUploadURL, err)
}
u.Query().Set("user", strings.TrimPrefix("user-", auth.Username))
u.Query().Set("key", auth.Password)
q := u.Query()
q.Set("user", strings.TrimPrefix(auth.Username, "user-"))
q.Set("key", auth.Password)
u.RawQuery = q.Encode()
resp, err := http.Post(u.String(), "application/json", bytes.NewReader(req))
if err != nil {
return err
Expand Down

0 comments on commit bf85695

Please sign in to comment.