Skip to content
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

fix: Stop using path.join to create URLs. #1455

Merged
merged 4 commits into from
Jun 21, 2022
Merged

fix: Stop using path.join to create URLs. #1455

merged 4 commits into from
Jun 21, 2022

Conversation

dcr-stripe
Copy link
Contributor

@dcr-stripe dcr-stripe commented Jun 17, 2022

r? @kamil-stripe @pakrym-stripe

Summary

Stop using path.join to create URLs and instead just join them. path.join is meant for file system paths, and introduces extra surprises. eg. passing ./.. to a path parameter would update the entire path (path.join('a, '..', 'b' => 'b' and path.join('a', '.', 'b') => a/b). This also eliminates the need for transforming the Windows path separator.

Unfortunately because this is part of the public API we can't just do .join('/') and call it quits. path.join transforms // to /, and users can technically pass in values which lead to // since we don't document the expectations. So to be safe, apply the same transformation.

Motivation

Remove unnecessary dependency. We unfortunately still use path in tests though.

Copy link
Contributor

@pakrym-stripe pakrym-stripe left a comment

Choose a reason for hiding this comment

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

🎉 !! CI is sad though...

lib/StripeResource.js Outdated Show resolved Hide resolved
dcr-stripe and others added 2 commits June 17, 2022 14:26
Co-authored-by: Kamil Pajdzik <99290280+kamil-stripe@users.noreply.github.com>
@stripe-ci stripe-ci assigned dcr-stripe and unassigned kamil-stripe Jun 17, 2022
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.

3 participants