Skip to content

Commit

Permalink
Clean hostname/name sent to operator to fix issue of hostname with li…
Browse files Browse the repository at this point in the history
…nebreaks
  • Loading branch information
aviramha committed May 29, 2024
1 parent 857dd47 commit 4c7c408
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions mirrord/operator/src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -514,21 +514,19 @@ impl OperatorApi {
.uri(self.connect_url(&session_info))
.header("x-session-id", session_info.metadata.session_id.to_string());

debug!(
"session_id {}",
session_info.metadata.session_id.to_string()
);
// we trim name/hostname since we saw users having line breaks and maybe it can have
// non ascii stuf???
if let Some(name) = name {
debug!(?name, "name");
builder =
builder.header("x-client-name", name.replace(|c: char| !c.is_ascii(), ""));
builder = builder.header(
"x-client-name",
name.replace(|c: char| !c.is_ascii(), "").trim(),
);
};

if let Some(hostname) = hostname {
debug!(?hostname, "hostname");
builder = builder.header(
"x-client-hostname",
hostname.replace(|c: char| !c.is_ascii(), ""),
hostname.replace(|c: char| !c.is_ascii(), "").trim(),
);
};

Expand Down

0 comments on commit 4c7c408

Please sign in to comment.