fix: make repo clone https/ssh listener conditional (#7431)

- It's possible that either the SSH or HTTPS element does not exist. Thus make adding the event listener conditional.
- Ref: forgejo/forgejo#7408
- Reported-by: @0ko

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/7431
Reviewed-by: 0ko <0ko@noreply.codeberg.org>
Co-authored-by: Gusted <postmaster@gusted.xyz>
Co-committed-by: Gusted <postmaster@gusted.xyz>
This commit is contained in:
Gusted 2025-04-02 18:53:01 +00:00 committed by Gusted
parent 5706a2452e
commit ee5b102142

View file

@ -41,11 +41,11 @@ export function initRepoCloneLink() {
return;
}
repoCloneSSH.addEventListener('click', () => {
repoCloneSSH?.addEventListener('click', () => {
localStorage.setItem('repo-clone-protocol', 'ssh');
window.updateCloneStates();
});
repoCloneHTTPS.addEventListener('click', () => {
repoCloneHTTPS?.addEventListener('click', () => {
localStorage.setItem('repo-clone-protocol', 'https');
window.updateCloneStates();
});