1
0
Fork 0
mirror of https://codeberg.org/forgejo/forgejo.git synced 2024-12-22 12:54:53 -05:00

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
This commit is contained in:
silverwind 2020-11-30 18:47:01 +01:00 committed by GitHub
parent d7ab72681d
commit 21cf205dc7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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;
});