Skip to content

fix: supabase/supabase#1915 encode query string parameter values #98

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 13, 2021
Merged

fix: supabase/supabase#1915 encode query string parameter values #98

merged 1 commit into from
Jun 13, 2021

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 join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants