Skip to content

Commit ad45617

Browse files
committed
refactor: append existing query params (raw)
1 parent 91debbb commit ad45617

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

internal/mailer/templatemailer/templatemailer.go

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -502,12 +502,13 @@ func getPath(filepath string, params *emailParams) (*url.URL, error) {
502502
}
503503
}
504504
if params != nil {
505-
path.RawQuery = fmt.Sprintf("token=%s&type=%s&redirect_to=%s", url.QueryEscape(params.Token), url.QueryEscape(params.Type), encodeRedirectURL(params.RedirectTo))
505+
baseQuery := fmt.Sprintf("token=%s&type=%s&redirect_to=%s", url.QueryEscape(params.Token), url.QueryEscape(params.Type), encodeRedirectURL(params.RedirectTo))
506506

507-
// If the path already has query params, append them
508-
q := path.Query().Encode()
509-
if q != "" {
510-
path.RawQuery += fmt.Sprintf("&%s", q)
507+
// Append existing query params if any
508+
if existing := path.RawQuery; existing != "" {
509+
path.RawQuery = fmt.Sprintf("%s&%s", baseQuery, existing)
510+
} else {
511+
path.RawQuery = baseQuery
511512
}
512513
}
513514
return path, nil

0 commit comments

Comments
 (0)