瀏覽代碼

Fix bogus http requests on diffs (#13760) (#13761)

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
tags/v1.13.0
silverwind 3 年之前
父節點
當前提交
6e14773c44
沒有連結到貢獻者的電子郵件帳戶。
共有 1 個檔案被更改,包括 1 行新增0 行删除
  1. 1
    0
      web_src/js/index.js

+ 1
- 0
web_src/js/index.js 查看文件

}); });
$(document).on('click', '.blob-excerpt', async ({currentTarget}) => { $(document).on('click', '.blob-excerpt', async ({currentTarget}) => {
const {url, query, anchor} = currentTarget.dataset; const {url, query, anchor} = currentTarget.dataset;
if (!url) return;
const blob = await $.get(`${url}?${query}&anchor=${anchor}`); const blob = await $.get(`${url}?${query}&anchor=${anchor}`);
currentTarget.closest('tr').outerHTML = blob; currentTarget.closest('tr').outerHTML = blob;
}); });

Loading…
取消
儲存