Fix adapter-id over-escaping when decoding an Ice proxy (#4644)#4648
Merged
Conversation
When decoding an Ice proxy, the adapter ID was passed through Uri.EscapeDataString before being stored as the adapter-id service address parameter value. Uri.EscapeDataString follows RFC 3986 and percent-escapes characters such as '/', ':', and '@' that are valid in a service address parameter value, breaking equality with a ServiceAddress built from the equivalent URI string. Replace this with a narrower EscapeAdapterId helper that escapes only the characters that are actually invalid in a service address parameter value, plus '%'.
There was a problem hiding this comment.
Pull request overview
This pull request fixes incorrect over-escaping of the Ice proxy adapter-id when decoding an Ice-encoded proxy into a ServiceAddress, ensuring the decoded ServiceAddress.Params["adapter-id"] matches the value produced when building the same address from an equivalent URI string.
Changes:
- Replaced
Uri.EscapeDataString(adapterId)with a dedicatedEscapeAdapterIdthat only percent-escapes characters invalid for service address parameter values (plus%). - Added test coverage for adapter-id values that should remain unescaped (e.g.,
/,:,@,=,,,(,)), and documented the special case for a raw%in the URI string.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| tests/IceRpc.Ice.Tests/ProxyTests.cs | Adds test cases ensuring adapter-id round-trips without over-escaping for characters valid in service address param values. |
| src/IceRpc.Ice/Operations/IceProxyIceDecoderExtensions.cs | Introduces EscapeAdapterId and uses it when decoding adapter IDs into ServiceAddress parameters. |
pepone
approved these changes
May 14, 2026
externl
approved these changes
May 14, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When decoding an Ice proxy, the adapter ID was passed through Uri.EscapeDataString before being stored as the adapter-id service address parameter value. Uri.EscapeDataString follows RFC 3986 and percent-escapes characters such as '/', ':', and '@' that are valid in a service address parameter value, breaking equality with a ServiceAddress built from the equivalent URI string.
Replace this with a narrower EscapeAdapterId helper that escapes only the characters that are actually invalid in a service address parameter value, plus '%'.
Fixes #4644