Skip to content

Commit cbb1f21

Browse files
khaliqgantclaude
andcommitted
fix(relaycast): prevent URL double-path construction
When base URL already ends with /stream (e.g. wss://rt.relaycast.dev/stream), avoid appending /v1/stream which produced invalid double-path URLs like wss://host/stream/v1/stream. Now correctly preserves the existing /stream path. Cherry-picked from PR #412. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 104c742 commit cbb1f21

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

relay-broker/src/relaycast_ws.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ pub fn build_ws_stream_url(base_url: &str, token: &str) -> Result<String> {
239239

240240
let final_path = if path.is_empty() {
241241
"/v1/stream".to_string()
242-
} else if path.ends_with("/v1/stream") {
242+
} else if path.ends_with("/v1/stream") || path.ends_with("/stream") {
243243
path
244244
} else if path.ends_with("/v1") {
245245
format!("{path}/stream")
@@ -305,7 +305,7 @@ mod tests {
305305
build_ws_stream_url("wss://rt.relaycast.dev/stream?client=broker", "tok_3").unwrap();
306306
assert_eq!(
307307
url,
308-
"wss://rt.relaycast.dev/stream/v1/stream?client=broker&token=tok_3"
308+
"wss://rt.relaycast.dev/stream?client=broker&token=tok_3"
309309
);
310310
}
311311

0 commit comments

Comments
 (0)