Skip to content

Commit dff4873

Browse files
Frandoclaude
andauthored
fix: prepend https:// to view_url when Host header lacks scheme (#11)
curl sends Host without a scheme, so the push response's view_url was missing the protocol prefix. Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 03ab97d commit dff4873

1 file changed

Lines changed: 11 additions & 9 deletions

File tree

patchbay-server/src/lib.rs

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1163,15 +1163,17 @@ async fn push_run(
11631163
// Notify subscribers about new run
11641164
let _ = state.runs_tx.send(());
11651165

1166-
let view_url = format!(
1167-
"{}/group/{}",
1168-
headers
1169-
.get("origin")
1170-
.and_then(|v| v.to_str().ok())
1171-
.or_else(|| headers.get("host").and_then(|v| v.to_str().ok()))
1172-
.unwrap_or(""),
1173-
run_name
1174-
);
1166+
let base = headers
1167+
.get("origin")
1168+
.and_then(|v| v.to_str().ok())
1169+
.or_else(|| headers.get("host").and_then(|v| v.to_str().ok()))
1170+
.unwrap_or("");
1171+
let base = if !base.is_empty() && !base.starts_with("http") {
1172+
format!("https://{base}")
1173+
} else {
1174+
base.to_string()
1175+
};
1176+
let view_url = format!("{base}/group/{run_name}");
11751177

11761178
// run_name is the group name (first path component for all sims inside)
11771179
let result = serde_json::json!({

0 commit comments

Comments
 (0)