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

URL enconding of AID alias name in rest calls #233

Merged
merged 8 commits into from
Apr 3, 2024

Conversation

rodolfomiranda
Copy link
Collaborator

This PR fix issue #204 Handling of special characters and white spaces in alias names by adding a missing url encoding and the correct content-length calculation.

Without changes in KERIA it will fix the spaces and some special characters such as @ and $, but not other special character such as the ö letter used in Swedish.
In KERIA, it seems that Falcon modifies the req.path when passing it to the middleware that check signatures. Need further investigation.

Copy link

codecov bot commented Mar 14, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 82.85%. Comparing base (e2b2f6e) to head (5636686).
Report is 1 commits behind head on development.

Additional details and impacted files
@@               Coverage Diff               @@
##           development     #233      +/-   ##
===============================================
- Coverage        82.86%   82.85%   -0.01%     
===============================================
  Files               46       47       +1     
  Lines             4190     4200      +10     
  Branches          1044     1046       +2     
===============================================
+ Hits              3472     3480       +8     
- Misses             689      691       +2     
  Partials            29       29              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@pfeairheller pfeairheller requested review from m00sey and lenkan March 14, 2024 14:06
Copy link
Collaborator

@lenkan lenkan left a comment

Choose a reason for hiding this comment

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

Nice! It would be nice with a unit test for the path encoding. Should be fairly straightforward in aiding.test.ts

src/keri/app/clienting.ts Outdated Show resolved Hide resolved
@rodolfomiranda
Copy link
Collaborator Author

Nice! It would be nice with a unit test for the path encoding. Should be fairly straightforward in aiding.test.ts

added

@rodolfomiranda rodolfomiranda requested a review from lenkan March 15, 2024 23:22
@lenkan
Copy link
Collaborator

lenkan commented Mar 18, 2024

Nice! It would be nice with a unit test for the path encoding. Should be fairly straightforward in aiding.test.ts

added

I believe the added test does not invoke the get method? Only the create, which does not do any encodeURIComponent.

Should be something like this

  await client.identifiers().get("a name with ñ!")
  const lastCall = client.getLastMockRequest();
  assert.equal(lastCall.path, '/identifiers/a%20name%20with%20%C3%B1!');

@rodolfomiranda
Copy link
Collaborator Author

You are right. I updated the code.

test/app/aiding.test.ts Outdated Show resolved Hide resolved
Copy link
Collaborator

@lenkan lenkan left a comment

Choose a reason for hiding this comment

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

LGTM

Co-authored-by: Daniel Lenksjö <[email protected]>
@lenkan
Copy link
Collaborator

lenkan commented Apr 3, 2024

@rodolfomiranda Should we merge this?

@rodolfomiranda
Copy link
Collaborator Author

@rodolfomiranda Should we merge this?

Yes!

@lenkan lenkan merged commit ac6dac4 into WebOfTrust:development Apr 3, 2024
8 checks passed
daviddm pushed a commit to daviddm/signify-ts that referenced this pull request May 8, 2024
* URL enconding of name in api call

* prettier

* content-lenght header not needed

* add test

* remove debris

* fix test

* pretty

* Update test/app/aiding.test.ts
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.

2 participants