Skip to content

Commit

Permalink
Fix bogus http requests on diffs (#13760) (#13761)
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 25421f0 commit 6e14773
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions web_src/js/index.js
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 6e14773

Please sign in to comment.