Skip to content

Commit

Permalink
Fix pulsar uri scheme (#5470)
Browse files Browse the repository at this point in the history
  • Loading branch information
miton18 authored Oct 3, 2024
1 parent 1cf019f commit e706297
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion quickwit/quickwit-config/src/source_config/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ use quickwit_common::is_false;
use quickwit_common::uri::Uri;
use quickwit_proto::metastore::SourceType;
use quickwit_proto::types::SourceId;
use regex::Regex;
use serde::de::Error;
use serde::{Deserialize, Deserializer, Serialize};
use serde_json::Value as JsonValue;
Expand Down Expand Up @@ -498,8 +499,9 @@ pub enum PulsarSourceAuth {
fn pulsar_uri<'de, D>(deserializer: D) -> Result<String, D::Error>
where D: Deserializer<'de> {
let uri: String = Deserialize::deserialize(deserializer)?;
let re: Regex = Regex::new(r"pulsar(\+ssl)?://.*").expect("regular expression should compile");

if uri.strip_prefix("pulsar://").is_none() {
if !re.is_match(uri.as_str()) {
return Err(Error::custom(format!(
"invalid Pulsar uri provided, must be in the format of `pulsar://host:port/path`. \
got: `{uri}`"
Expand Down

0 comments on commit e706297

Please sign in to comment.