Skip to content

Fix adapter-id over-escaping when decoding an Ice proxy (#4644)#4648

Merged
bernardnormier merged 2 commits into
icerpc:mainfrom
bernardnormier:fix4644
May 14, 2026
Merged

Fix adapter-id over-escaping when decoding an Ice proxy (#4644)#4648
bernardnormier merged 2 commits into
icerpc:mainfrom
bernardnormier:fix4644

Conversation

@bernardnormier
Copy link
Copy Markdown
Member

@bernardnormier bernardnormier commented May 14, 2026

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

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 '%'.
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

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 dedicated EscapeAdapterId that 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.

@bernardnormier bernardnormier merged commit ade18df into icerpc:main May 14, 2026
10 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.

Adapter ID over-escaping during decoding

4 participants