Skip to content

Trim trailing slashes from base_url - #65

Open
manlikeHB wants to merge 1 commit into
lightningdevkit:mainfrom
manlikeHB:64-trim-trailing-slashes
Open

manlikeHB wants to merge 1 commit into
lightningdevkit:mainfrom
manlikeHB:64-trim-trailing-slashes

Conversation

@manlikeHB

Copy link
Copy Markdown

A base_url supplied with a trailing slash like https://vss.example.com/, currently yields request paths such as //getObject. The empty path segment makes that a distinct identifier rather than another spelling of /getObject, so the client is sending the wrong request, and any strict server rejects it.

We now trim trailing slashes from base_url at construction, covering repeated slashes as well as a single one. All four public constructors funnel through a private from_parts helper, so the two that previously built Self directly can no longer diverge from the ones delegating to from_client. Normalizing at construction rather than at request time means base_url() reports the URL actually in use.

The public API is unchanged. The one behavioral difference is that base_url() no longer echoes a
value with trailing slashes.

This is the client half of lightningdevkit/vss-server#118, which makes the server tolerant of repeated and trailing slashes when routing.

Fixes #64.

A `base_url` with a trailing slash produced request paths like
`//getObject`: the extra empty path segment makes that a different
identifier rather than an equivalent spelling of `/getObject`, and
strict servers reject it.

We now normalize `base_url` at construction time. All four public
constructors funnel through a private `from_parts`, so the stored value
is always the one used to build request paths, and `base_url()` reports
it instead of echoing the input.
@ldk-reviews-bot

ldk-reviews-bot commented Nov 26, 2026 •

Copy link
Copy Markdown

I've assigned @tankyleo as a reviewer!
I'll wait for their review and will help manage the review process.
Once they submit their review, I'll check if a second reviewer would be helpful.

@manlikeHB

Copy link
Copy Markdown
Author

The build (1.75.0) failure here is pre-existing, not caused by this PR. I opened #66 to raise the MSRV to 1.85.0, which
ldk-node already requires

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.

Trim trailing slashes from base_url so requests don't use //endpoint paths

2 participants