Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

don't escape paths twice when using a schema registry #2498

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

huttotw
Copy link

@huttotw huttotw commented Apr 8, 2024

In the case where we had a subject like my/deeply/nested/message.proto it was being doubly escaped like:

/subjects/my%252Fdeeply%252Fnested%252Fmessage.proto/versions/1

when it should be:

/subjects/my%2Fdeeply%2Fnested%2Fmessage.proto/versions/1

Note that by default Go will unescape in the Path field of url.URL, to access the raw path you can use RawPath. Not sure if we should change this test func to use the RawPath or not?

@Jeffail
Copy link
Member

Jeffail commented Apr 8, 2024

Hey @huttotw, is there a formal spec for how a schema registry server expects these paths to be formed? We've had issues with this before: #2190 but I find it very difficult to get this "right" when we're having to guess based on different implementations of the server.

Signed-off-by: Trevor Hutto <trevorhutto@fullstory.com>
Signed-off-by: Trevor Hutto <trevorhutto@fullstory.com>
@huttotw
Copy link
Author

huttotw commented Apr 8, 2024

@Jeffail thanks for the quick response!

I'm not certain that the bug was fixed in #2190, I tried to reproduce the scenario here. Let me know what you think!

I'm referencing Confluent's docs here, but the only conclusion I can draw is that subject should be treated as an opaque identifier:

https://docs.confluent.io/platform/current/schema-registry/develop/api.html#get--subjects-(string-%20subject)-versions-(versionId-%20version)

Nevertheless, I don't think we want to escape twice; that seems a bit unexpected from all sides. It looks like we should be using the JoinPath method instead of manually setting the Path based on a JoinPath result, there are some other things happening under the hood it looks like when Path gets set via JoinPath.

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.

None yet

2 participants