aboutsummaryrefslogtreecommitdiffstats
path: root/web_src
diff options
context:
space:
mode:
authorsilverwind <me@silverwind.io>2020-11-30 18:47:01 +0100
committerGitHub <noreply@github.com>2020-11-30 12:47:01 -0500
commit21cf205dc770d637a9ba636644cf8bf690cc100d (patch)
tree064c58b380f4bd8c231bc6ceed39759e48a69989 /web_src
parentd7ab72681d109ea3d0057df3fd2a96f6c7aff382 (diff)
downloadgitea-21cf205dc770d637a9ba636644cf8bf690cc100d.tar.gz
gitea-21cf205dc770d637a9ba636644cf8bf690cc100d.zip
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
Diffstat (limited to 'web_src')
-rw-r--r--web_src/js/index.js1
1 files changed, 1 insertions, 0 deletions
diff --git a/web_src/js/index.js b/web_src/js/index.js
index cd353b15f2..8f2de67db0 100644
--- a/web_src/js/index.js
+++ b/web_src/js/index.js
@@ -2118,6 +2118,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;
});