From 17f04114419bca0d20d2474cee61beb18e4caaa0 Mon Sep 17 00:00:00 2001 From: wxiaoguang Date: Thu, 12 Dec 2024 10:01:20 +0800 Subject: [PATCH] Fix clone panel js error (#32798) side effect of jquery removal, fix #32797 --- web_src/js/features/repo-common.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/web_src/js/features/repo-common.ts b/web_src/js/features/repo-common.ts index 40932f6667..90860720e4 100644 --- a/web_src/js/features/repo-common.ts +++ b/web_src/js/features/repo-common.ts @@ -75,12 +75,12 @@ function initCloneSchemeUrlSelection(parent: Element) { }; updateClonePanelUi(); - - tabSsh.addEventListener('click', () => { + // tabSsh or tabHttps might not both exist, eg: guest view, or one is disabled by the server + tabSsh?.addEventListener('click', () => { localStorage.setItem('repo-clone-protocol', 'ssh'); updateClonePanelUi(); }); - tabHttps.addEventListener('click', () => { + tabHttps?.addEventListener('click', () => { localStorage.setItem('repo-clone-protocol', 'https'); updateClonePanelUi(); });