redpanda-data / redpanda-data/connect
schema_registry_encode double encodes path params
Open
Nobody has claimed this yet.
bug
processors
ux
- Dominant language
- Go
- Stars
- 8.8k
- Forks
- 969
- Avg merge
- 1d 13h
- Merged PRs (30d)
- 64
Description
When using schema_registry_encode processor '/' character is double encoded.
With subject like:
- schema_registry_encode:
url: http://my-url
subject: "main/common"
refresh_period: 10m
The offending code seems to be:
// internal/impl/confluent/client.go
func (c *schemaRegistryClient) doRequest(ctx context.Context, verb, reqPath string) (resCode int, resBody []byte, err error) {
reqURL := *c.schemaRegistryBaseURL
if reqURL.Path, err = url.JoinPath(reqURL.Path, reqPath); err != nil {
return
}
var req *http.Request
// LOG ADDED FOR DEBUGGING
fmt.Printf("reqURL: %v\n", reqURL.String())
if req, err = http.NewRequestWithContext(ctx, verb, reqURL.String(), http.NoBody); err != nil {
return
}
// reqURL: http://my-url/subjects/main%252Fcommon/versions/latest
Expected Parsed URL:
http://my-url/subjects/main%2Fcommon/versions/latest
Actual Parsed URL:
http://my-url/subjects/main%252Fcommon/versions/latest
Clearly the '/' character is double encoded.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in internal/impl/confluent/client.go at schemaRegistryClient.doRequest and reproduce the request using a subject such as main/common. Trace how url.JoinPath and reqURL.String encode the path; done means the request URL contains main%2Fcommon rather than main%252Fcommon.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- api, backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 50/100