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(backend): make the rafiki wallet url case insensitive #2833

Merged
merged 18 commits into from
Sep 18, 2024
Merged
Changes from 14 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions packages/backend/src/open_payments/wallet_address/service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ async function createWalletAddress(

return await WalletAddress.query(deps.knex)
.insertGraphAndFetch({
url: options.url,
url: options.url.toLowerCase(),
Copy link
Contributor

Choose a reason for hiding this comment

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

let's add some tests for these :)

Copy link
Contributor

Choose a reason for hiding this comment

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

@s100tist
in the catch statement, you can check for err instanceof UniqueViolationError to catch those cases where you are trying to create a duplicate wallet address

publicName: options.publicName,
assetId: options.assetId,
additionalProperties: additionalProperties
Expand Down Expand Up @@ -296,7 +296,7 @@ async function getWalletAddressByUrl(
url: string
): Promise<WalletAddress | undefined> {
const walletAddress = await WalletAddress.query(deps.knex)
.findOne({ url })
.findOne({ url: url.toLowerCase() })
.withGraphFetched('asset')
return walletAddress || undefined
}
Expand Down