Skip to content

Conversation

@dogukanakkaya
Copy link

What kind of change does this PR introduce?

This is a bug fix for issue: supabase/supabase#36990

What is the current behavior?

If you change ConfirmationURL for an email to https://supabase.com?flow=test the sent email will override the flow=test query string and only add specified parameters.

What is the new behavior?

New behavior fixes that and appends the whatever in the ConfirmationURL after the specified parameters. ?token_hash=xxxx&email=xxxxxx&flow=test

@dogukanakkaya dogukanakkaya requested a review from a team as a code owner October 4, 2025 14:38
Comment on lines 505 to 510
path.RawQuery = fmt.Sprintf("token=%s&type=%s&redirect_to=%s", url.QueryEscape(params.Token), url.QueryEscape(params.Type), encodeRedirectURL(params.RedirectTo))

// If the path already has query params, append them
q := path.Query().Encode()
if q != "" {
path.RawQuery += fmt.Sprintf("&%s", q)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of string concatenation, this should build the query object instead.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

By default Go alphabetically sorts the query parameters which causes other tests to fail. Even if I change that, using .Encode() encodes the redirect_to=https%3A%2F%2Fexample.com&..., again this also fails. I either need to change the tests in order to be compatible with the code. Nonetheless, I'll refactor this part a bit.

If you want me to change the tests as well and use query builder I can do that also.

@dogukanakkaya dogukanakkaya force-pushed the feat/get-path-should-append-existing-query-strings branch from e9a6fd3 to ad45617 Compare October 29, 2025 14:41
@dogukanakkaya dogukanakkaya requested a review from hf October 29, 2025 14:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants