From a4bc955cebf0b8a69097e94adb43caae0d7f8383 Mon Sep 17 00:00:00 2001 From: silverwind Date: Mon, 30 Nov 2020 18:47:01 +0100 Subject: [PATCH] Fix bogus http requests on diffs (#13760) The .blob-excerpt elements don't have these data attributes in some cases resulting in bogus http request when expanding a diff and clicking into the expanded area. This prevents those. Should backport to 1.13. Fixes: https://github.com/go-gitea/gitea/issues/13759 --- web_src/js/index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/web_src/js/index.js b/web_src/js/index.js index 1c479d0e7d86b..2e7b13cb64370 100644 --- a/web_src/js/index.js +++ b/web_src/js/index.js @@ -2089,6 +2089,7 @@ function initCodeView() { }); $(document).on('click', '.blob-excerpt', async ({currentTarget}) => { const {url, query, anchor} = currentTarget.dataset; + if (!url) return; const blob = await $.get(`${url}?${query}&anchor=${anchor}`); currentTarget.closest('tr').outerHTML = blob; });