Skip to content

Commit

Permalink
urlencode subject in confluent schema registry URLs (#759)
Browse files Browse the repository at this point in the history
  • Loading branch information
emef authored Oct 21, 2024
1 parent a431d75 commit 54bccb1
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions crates/arroyo-rpc/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ dirs = "5.0.1"
arc-swap = "1.7.1"
datafusion-common = { workspace = true }
rand = "0.8.5"
percent-encoding = "2.3.1"

[build-dependencies]
tonic-build = { workspace = true }
Expand Down
4 changes: 3 additions & 1 deletion crates/arroyo-rpc/src/schema_resolver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ use base64::write::EncoderWriter;
use futures::future;
use futures::stream::FuturesUnordered;
use futures::StreamExt;
use percent_encoding::{percent_encode, NON_ALPHANUMERIC};
use reqwest::header::{HeaderMap, HeaderValue};
use reqwest::{Client, StatusCode, Url};
use serde::de::DeserializeOwned;
Expand Down Expand Up @@ -346,9 +347,10 @@ impl ConfluentSchemaRegistry {
}

fn subject_endpoint(&self, subject: &str) -> anyhow::Result<Url> {
let encoded_subject = percent_encode(subject.as_bytes(), NON_ALPHANUMERIC).to_string();
self.client
.endpoint
.join(&format!("subjects/{}/versions/", subject))
.join(&format!("subjects/{}/versions/", encoded_subject))
.map_err(|e| {
anyhow!(
"'{}' is not a valid schema registry endpoint: {}",
Expand Down

0 comments on commit 54bccb1

Please sign in to comment.