Skip to content

cli: fix parsing bugs in encode-uri#132299

Open
stevendanna wants to merge 1 commit intocockroachdb:masterfrom
stevendanna:ssd/miscode
Open

cli: fix parsing bugs in encode-uri#132299
stevendanna wants to merge 1 commit intocockroachdb:masterfrom
stevendanna:ssd/miscode

Conversation

@stevendanna
Copy link
Collaborator

The command as documented makes the scheme optional. Unfortunately, when parsing without a scheme we had two bugs: (1) our attempt to add a scheme added the scheme separate into the scheme name and (2) certain combinations of components could easily be parsed incorrectly:

 > ./cockroach-v24.3.0-alpha.1.darwin-11.0-arm64/cockroach encode-uri foo
postgresql://://root@defaultdb?options=-ccluster%3Dsystem

> ./cockroach-v24.3.0-alpha.1.darwin-11.0-arm64/cockroach encode-uri foo@bar
postgresql://://root@defaultdb?options=-ccluster%3Dsystem

Here I've opted to look for the optional schemes we support before parsing.

Another possibility is that we could make the scheme non-optional.

Epic: none
Release note: None

The command as documented makes the scheme optional. Unfortunately,
when parsing without a scheme we had two bugs: (1) our attempt to add
a scheme added the scheme separate into the scheme name and (2)
certain combinations of components could easily be parsed incorrectly:

```
 > ./cockroach-v24.3.0-alpha.1.darwin-11.0-arm64/cockroach encode-uri foo
postgresql://://root@defaultdb?options=-ccluster%3Dsystem

> ./cockroach-v24.3.0-alpha.1.darwin-11.0-arm64/cockroach encode-uri foo@bar
postgresql://://root@defaultdb?options=-ccluster%3Dsystem
```

Here I've opted to look for the optional schemes we support before
parsing.

Another possibility is that we could make the scheme non-optional.

Epic: none
Release note: None
@stevendanna stevendanna requested review from a team and dt October 10, 2024 11:49
@stevendanna stevendanna requested a review from a team as a code owner October 10, 2024 11:49
@stevendanna stevendanna requested a review from a team October 10, 2024 11:49
@blathers-crl
Copy link

blathers-crl bot commented Oct 10, 2024

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.

@stevendanna stevendanna removed request for a team October 10, 2024 11:50
@cockroach-teamcity
Copy link
Member

This change is Reviewable

@stevendanna
Copy link
Collaborator Author

Bleh, I keep intending to merge this with the other URI command and failing to.

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