You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
First off, thanks for making this package available.
Now for the "bug".
Turns out that it is possible to have a space character in subject, for example "My little subject" is possible to create in at least Confluent Platform's Kafka schema registry.
When using *SchemaRegistryClient.GetSchemaVersion("My little subject") it will generate an http request like so:
GET /subjects/My+little+subject/versions
Unfortunately, this is not considered correct and schema registry will give us a not found. According to a blog post referred in this StackOverflow post, the package should encode space characters like so:
GET /subjects/My%20little%20subject/versions
This is because the URI standard, seems to expect:
For URLs, a space in the path fragment has to be encoded with %20. A space in the query fragment can be encoded with +.
Since the subject is encoded into the URL path, a solution is to use url.PathEscape instead of url.QueryEscape for the cases where were escaping the path.
I'll open a pull-request associated with this issue,
The text was updated successfully, but these errors were encountered:
limoges
added a commit
to limoges/srclient
that referenced
this issue
Feb 18, 2025
Why?
There is a bug detected when, for example, a subject contains space
characters.
The package currently uses `+` to encode space in path instead of `%20`.
There might be other encoding issues I'm not aware of.
What?
I search through code for usage of `httpRequest` and reviewed all calls
to make sure they use url.PathEscape when encoding path parameters.
Some were using url.QueryEscape. Some had no escaping.
Addresses:
riferrei#113
First off, thanks for making this package available.
Now for the "bug".
Turns out that it is possible to have a space character in subject, for example "My little subject" is possible to create in at least Confluent Platform's Kafka schema registry.
When using
*SchemaRegistryClient.GetSchemaVersion("My little subject")
it will generate an http request like so:Unfortunately, this is not considered correct and schema registry will give us a not found. According to a blog post referred in this StackOverflow post, the package should encode space characters like so:
This is because the URI standard, seems to expect:
Since the subject is encoded into the URL path, a solution is to use
url.PathEscape
instead ofurl.QueryEscape
for the cases where were escaping the path.I'll open a pull-request associated with this issue,
The text was updated successfully, but these errors were encountered: