Skip to content

Commit

Permalink
Fix bogus http requests on diffs (go-gitea#13760)
Browse files Browse the repository at this point in the history
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: go-gitea#13759
  • Loading branch information
silverwind committed Nov 30, 2020
1 parent 25421f0 commit a4bc955
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions web_src/js/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
});
Expand Down

0 comments on commit a4bc955

Please sign in to comment.