diff --git a/web_src/js/index.js b/web_src/js/index.js index f7b4ef24d8b3..b8088123729f 100644 --- a/web_src/js/index.js +++ b/web_src/js/index.js @@ -1109,8 +1109,10 @@ async function initRepository() { $('.clone-url').text($(this).data('link')); $('#repo-clone-url').val($(this).data('link')); $(this).addClass('blue'); - $('#repo-clone-ssh').removeClass('blue'); - localStorage.setItem('repo-clone-protocol', 'https'); + if ($('#repo-clone-ssh').length > 0) { + $('#repo-clone-ssh').removeClass('blue'); + localStorage.setItem('repo-clone-protocol', 'https'); + } }); $('#repo-clone-url').on('click', function () { $(this).select(); @@ -2436,7 +2438,9 @@ $(document).ready(async () => { if ($('#repo-clone-url').length > 0) { switch (localStorage.getItem('repo-clone-protocol')) { case 'ssh': - if ($('#repo-clone-ssh').length === 0) { + if ($('#repo-clone-ssh').length > 0) { + $('#repo-clone-ssh').trigger('click'); + } else { $('#repo-clone-https').trigger('click'); } break;