Skip to content

Jakarta REST client: do not produce '//' when base URI ends in '/' - #938

Merged
arturobernalg merged 1 commit into
apache:masterfrom
arturobernalg:rest-client-append-trailing-slash
Nov 13, 2026
Merged

arturobernalg merged 1 commit into
apache:masterfrom
arturobernalg:rest-client-append-trailing-slash

Conversation

@arturobernalg

Copy link
Copy Markdown
Member

Fixes apache/httpcomponents-core#745 in the layer where it belongs. A base URI ending in '/' has an empty last path segment, so RestInvocationHandler's append produced '//'. Drops that trailing empty segment before appending, the same way ResourceIfaceScanner#join already does for class+method paths.

URIBuilder itself is untouched; an empty segment is still meaningful there.

@arturobernalg
arturobernalg requested a review from ok2c November 12, 2026 20:04
@arturobernalg

Copy link
Copy Markdown
Member Author

@PDGGK please check

RestInvocationHandler appends the resolved resource path after the
base URI's path segments. A base URI ending in '/' has an empty last
segment, so the append produced a double slash. Drop that trailing
empty segment before appending, the same way ResourceIfaceScanner#join
already does when joining a resource class's path with its method's.

URIBuilder itself is unchanged: an empty path segment is meaningful
per RFC 3986 and this is specific to how the REST client joins two
already-resolved paths, not to path segment manipulation in general.

Follow-up to apache/httpcomponents-core#745, which traced the bug to
this exact join but put the fix in the wrong layer (URIBuilder).
@arturobernalg
arturobernalg force-pushed the rest-client-append-trailing-slash branch from 06d3b89 to 359420c Compare November 12, 2026 20:30
@arturobernalg
arturobernalg merged commit 430191f into apache:master Nov 13, 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.

2 participants