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

improve: handle trailing and duplicate / in mint urls #87

Merged
merged 1 commit into from
Sep 20, 2023

Conversation

thesimplekid
Copy link
Contributor

@thesimplekid thesimplekid commented Sep 18, 2023

Description

I've been having an issue where mint urls with a trailing / will cause errors in this library as it ends up with duplicate / in the mint urls. This adds a joinUrls function to remove duplicate / when joining url instead of just appending the path to the mint url string,

The other way I thought to do this is to strip the trailing / when creating a new mint. However, since these functions are publicly exposed think its best to handle mint urls that maybe passed in with a trailing /.

...

Changes

Add: Util joinUrls

PR Tasks

  • Open PR
  • run npm run test --> no failing unit tests
  • run npm run format

Copy link
Collaborator

@gandlafbtc gandlafbtc left a comment

Choose a reason for hiding this comment

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

LGTM, Thanks for the PR!

There is one thing that might be a footgun, which is that the mint URL can act as kind-of an ID. and by allowing this we could end up with 2 "IDs" for 1 mint, if not handled correctly by the client. one with / and one without.

I still think it's better to make this the clients problem, and not the libraries. The lib should accept both 👍

@thesimplekid
Copy link
Contributor Author

thesimplekid commented Sep 19, 2023 via email

Copy link
Contributor

@callebtc callebtc left a comment

Choose a reason for hiding this comment

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

Nice one

@gandlafbtc gandlafbtc merged commit bb12869 into cashubtc:main Sep 20, 2023
3 checks passed
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