Summary
Safely encode dynamic URL path segments before they are interpolated into service endpoint paths.
Current Behaviour
Service methods build paths with string interpolation, such as /guilds/${guildId}/roles and /guilds/${guildId}/members/${walletAddress}/roles. If a dynamic value contains reserved URL characters, the request path can become malformed.
Expected Behaviour
Dynamic path values should be encoded with encodeURIComponent before being inserted into endpoint paths.
Suggested Implementation
Add a small internal helper for path segment encoding, then use it for guildId, walletAddress, and any other dynamic path segment. Keep query parameter handling separate.
Files or Areas Likely Affected
src/roles/roles.service.ts
src/guilds/guilds.service.ts
src/utils/
tests/services.test.ts
Acceptance Criteria
Additional Notes
This should not loosen validation. Inputs should still be validated before path construction.
Summary
Safely encode dynamic URL path segments before they are interpolated into service endpoint paths.
Current Behaviour
Service methods build paths with string interpolation, such as
/guilds/${guildId}/rolesand/guilds/${guildId}/members/${walletAddress}/roles. If a dynamic value contains reserved URL characters, the request path can become malformed.Expected Behaviour
Dynamic path values should be encoded with
encodeURIComponentbefore being inserted into endpoint paths.Suggested Implementation
Add a small internal helper for path segment encoding, then use it for
guildId,walletAddress, and any other dynamic path segment. Keep query parameter handling separate.Files or Areas Likely Affected
src/roles/roles.service.tssrc/guilds/guilds.service.tssrc/utils/tests/services.test.tsAcceptance Criteria
guildIdvalues used in path segments are URL-encodedwalletAddressvalues used in path segments are URL-encoded/,#, or spaceAdditional Notes
This should not loosen validation. Inputs should still be validated before path construction.