confluentinc / confluent-kafka-dotnet

Confluent's Apache Kafka .NET client
https://github.com/confluentinc/confluent-kafka-dotnet/wiki
Apache License 2.0
2.78k stars 847 forks source link

Space characters in Confluent.SchemaRegistry.RestService encodes as '+' instead of '%20' #2163

Open Rand0mCitizen opened 6 months ago

Rand0mCitizen commented 6 months ago

Description

Incorrect encoding space characters of subject parameter value in all methods which accepts subject in Confluent.SchemaRegistry.RestService class.

How to reproduce

Register schema with subject field containing space character. Try to get schema version.

Request will be executed with incorrect url with '+' characters instead of '%20'. For example executing simple curl request curl http://127.0.0.1:8081/subjects/Some%20Domain%20Event/versions gives correct response - list of schema versions.

The reason for the problem is that Confluent.SchemaRegistry.RestService class uses WebUtility.UrlEncode to encode subject parameter value. I think you should use Uri.EscapeDataString to encode uri segment.

Package version used: Confluent.SchemaRegistry.2.3.0

rayokota commented 1 month ago

Fixed by https://github.com/confluentinc/confluent-kafka-dotnet/pull/2226