Skip to content

fix: sanitize TX_POOL_URL to ensure trailing slash#223

Closed
init4samwise wants to merge 1 commit intomainfrom
samwise/eng-1531-tx-pool-url-sanitize
Closed

fix: sanitize TX_POOL_URL to ensure trailing slash#223
init4samwise wants to merge 1 commit intomainfrom
samwise/eng-1531-tx-pool-url-sanitize

Conversation

@init4samwise
Copy link
Contributor

Summary

This PR addresses the issue where TX_POOL_URL configuration required a trailing slash for correct behavior with Url::join(). Previously, this was documented in the README but not enforced in code.

Changes

  1. src/lib.rs: Added ensure_trailing_slash() function that sanitizes the URL when config is loaded
  2. README.md: Removed the "(must end with /)" requirement from the docs since it's now handled automatically

Why this matters

The url::Url::join() function behaves differently based on whether the base URL ends with a slash:

  • http://example.com/api.join("transactions") → http://example.com/transactions (replaces path segment)
  • http://example.com/api/.join("transactions") → http://example.com/api/transactions (appends)

By sanitizing the URL at config load time, we prevent this subtle bug from affecting users who forget the trailing slash.

Closes ENG-1531

@prestwich
Copy link
Member

@init4samwise CI is broken

@init4samwise
Copy link
Contributor Author

Closing in favor of #224 which supersedes this with the same fix plus test corrections.

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