Skip to content

cli: attach postgresql:// scheme if not provided to encode-uri#160202

Closed
kev-cao wants to merge 1 commit intocockroachdb:masterfrom
kev-cao:cli/encode-uri-patch
Closed

cli: attach postgresql:// scheme if not provided to encode-uri#160202
kev-cao wants to merge 1 commit intocockroachdb:masterfrom
kev-cao:cli/encode-uri-patch

Conversation

@kev-cao
Copy link
Contributor

@kev-cao kev-cao commented Dec 26, 2025

The encode-uri command currently does parse the provided URI as a URI if no scheme is provided. As a consequence, if a string hostname:26257 is passed, it parses it as a path and no prefix/default root user is attached to the output.

If a URL-structure like hostname.com is provided, then the scheme is attached with a double ://, resulting in postgresql://://hostname.com.

Epic: None

Release note (cli change): Fixes a bug in the encode-uri utility that resulted in faulty encoding of URIs without a scheme. The postgresql:// scheme is now prefixed to any URIs missing a scheme.

The `encode-uri` command currently does parse the provided URI as a URI
if no scheme is provided. As a consequence, if a string `hostname:26257`
is passed, it parses it as a path and no prefix/default root user is
attached to the output.

If a URL-structure like `hostname.com` is provided, then the scheme is
attached with a double ://, resulting in `postgresql://://hostname.com`.

Epic: None

Release note (cli change): Fixes a bug in the `encode-uri` utility that
resulted in faulty encoding of URIs without a scheme. The
`postgresql://` scheme is now prefixed to any URIs missing a scheme.
@kev-cao kev-cao requested review from a team as code owners December 26, 2025 19:05
@blathers-crl
Copy link

blathers-crl bot commented Dec 26, 2025

It looks like your PR touches production code but doesn't add or edit any test code. Did you consider adding tests to your PR?

🦉 Hoot! I am a Blathers, a bot for CockroachDB. My owner is dev-inf.

@cockroach-teamcity
Copy link
Member

This change is Reviewable

@kev-cao kev-cao requested a review from dt December 26, 2025 19:06
@kev-cao
Copy link
Contributor Author

kev-cao commented Mar 6, 2026

Closing in favor of #164561

@kev-cao kev-cao closed this Mar 6, 2026
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