Skip to content
This repository was archived by the owner on Oct 10, 2025. It is now read-only.

Conversation

thebengeu
Copy link
Member

@thebengeu thebengeu commented Jun 12, 2021

What kind of change does this PR introduce?

Encodes query string parameter values.

What is the current behavior?

supabase/supabase#1915: redirectTo works but cuts the "and" params "&param2=val2&param3=val3".

What is the new behavior?

& and other special characters are encoded.

Additional context

I considered using balazsbotond/urlcat for readability and concision.

E.g.:

let urlParams: string[] = [`provider=${encodeURIComponent(provider)}`]
if (options?.redirectTo) {
  urlParams.push(`redirect_to=${encodeURIComponent(options.redirectTo)}`)
}
if (options?.scopes) {
  urlParams.push(`scopes=${encodeURIComponent(options.scopes)}`)
}
return `${this.url}/authorize?${urlParams.join('&')}`

Would become:

options.provider = provider
return urlcat(this.url, '/authorize', options)

However, the increase in bundle size would probably not be worth it.

@darora darora requested a review from kiwicopple June 12, 2021 22:16
@awalias
Copy link
Member

awalias commented Jun 13, 2021

nice one @thebengeu :)

@awalias awalias merged commit 3be3eb0 into supabase:master Jun 13, 2021
@github-actions
Copy link
Contributor

🎉 This PR is included in version 1.16.3 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants