Skip to content

feat: implement RFC 3986 compliant relay URL normalization#409

Merged
1-leo merged 3 commits intomasterfrom
feat/rfc-3986-relay-url-normalization
Feb 18, 2026
Merged

feat: implement RFC 3986 compliant relay URL normalization#409
1-leo merged 3 commits intomasterfrom
feat/rfc-3986-relay-url-normalization

Conversation

@nogringo
Copy link
Collaborator

@nogringo nogringo commented Feb 4, 2026

  • Add case normalization for scheme and host (Section 6.2.2.1)
  • Add percent-encoding normalization (Section 6.2.2.2)
  • Add dot segment removal from paths (Section 5.2.4)
  • Remove default ports: 443 for wss, 80 for ws (Section 6.2.3)
  • Preserve query strings and fragments
  • Optimize regex compilation as constants
  • Simplify cleanRelayUrls with map/whereType

Closes #6

@codecov
Copy link

codecov bot commented Feb 4, 2026

Codecov Report

❌ Patch coverage is 91.22807% with 5 lines in your changes missing coverage. Please review.
✅ Project coverage is 72.47%. Comparing base (907a342) to head (3006266).
⚠️ Report is 139 commits behind head on master.

Files with missing lines Patch % Lines
...ackages/ndk/lib/shared/helpers/url_normalizer.dart 86.66% 4 Missing ⚠️
packages/ndk/lib/shared/helpers/relay_helper.dart 96.29% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #409      +/-   ##
==========================================
+ Coverage   72.33%   72.47%   +0.13%     
==========================================
  Files         144      145       +1     
  Lines        5697     5743      +46     
==========================================
+ Hits         4121     4162      +41     
- Misses       1576     1581       +5     

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@nogringo nogringo self-assigned this Feb 4, 2026
@nogringo nogringo requested review from 1-leo and frnandu February 4, 2026 09:59
@1-leo
Copy link
Contributor

1-leo commented Feb 4, 2026

  • move to own file

Copy link
Contributor

@1-leo 1-leo left a comment

Choose a reason for hiding this comment

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

move to own file so it can be reused

Move RFC 3986 URL normalization functions to url_normalizer.dart for reusability across the codebase.
@nogringo nogringo requested a review from 1-leo February 7, 2026 20:53
Copy link
Collaborator

@frnandu frnandu left a comment

Choose a reason for hiding this comment

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

move the tests also into separate file dedicated to url_normalizer

@nogringo nogringo requested a review from frnandu February 17, 2026 21:47
@1-leo 1-leo merged commit e0ef64c into master Feb 18, 2026
3 checks passed
@frnandu frnandu added this to the 0.8 milestone Mar 10, 2026
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.

Use Uri for relay url normalization according to RFC 3986

3 participants