Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

compose: Fix Jitsi URL generation to append pathname.

Dhruv Viraabf92f1bb5ce
diff --git a/web/src/compose_call.ts b/web/src/compose_call.ts
index 3fceb3d6e58..f6d70e3902e 100644
--- a/web/src/compose_call.ts
+++ b/web/src/compose_call.ts
@@ -30,7 +30,8 @@ export function get_jitsi_server_url(video_call_id?: string): URL | null {
}
const url = new URL(base_url);
if (video_call_id !== undefined) {
- url.pathname = `/${video_call_id}`;
+ const separator = url.pathname.endsWith("/") ? "" : "/";
+ url.pathname += `${separator}${video_call_id}`;
}
return url;
}
diff --git a/web/tests/compose_video.test.cjs b/web/tests/compose_video.test.cjs
index bbe8eb5b60d..f6cf6d49dd8 100644
--- a/web/tests/compose_video.test.cjs
+++ b/web/tests/compose_video.test.cjs
@@ -153,6 +153,15 @@ test("videos", ({override}) => {
/\[translated: Join video call\.]\(https:\/\/realm.example.com\/\d{15}#config.startWithVideoMuted=false\)/;
assert.ok(called);
assert.match(syntax_to_insert, video_link_regex);
+
+ // Scenario where the URL has a path segment (like an auth token)
+ override(realm, "realm_jitsi_server_url", "https://jitsi.example.com/custom-token");
+ handler.call($textarea, ev);
+
+ video_link_regex =
+ /\[translated: Join video call\.\]\(https:\/\/jitsi\.example\.com\/custom-token\/\d{15}#config\.startWithVideoMuted=false\)/;
+
+ assert.match(syntax_to_insert, video_link_regex);
})();
(function test_zoom_video_and_audio_links_compose_clicked() {