Skip to content

Commit

Permalink
Fix bogus http requests on diffs
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: #13759
  • Loading branch information
silverwind committed Nov 30, 2020
1 parent d7ab726 commit 935c3c7
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 @@ -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;
});
Expand Down

0 comments on commit 935c3c7

Please sign in to comment.