Skip to content

Commit

Permalink
Fix context popup error
Browse files Browse the repository at this point in the history
  • Loading branch information
wxiaoguang committed Oct 22, 2021
1 parent 23d3692 commit f452c34
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion web_src/js/features/contextpopup.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,15 @@ export default function initContextPopups() {
if ($(this).hasClass('ref-external-issue')) {
return;
}
const [index, _issues, repo, owner] = $(this).attr('href').replace(/[#?].*$/, '').split('/').reverse();

// some links were not generated by us and may lack the href attribute
const href = $(this).attr('href');
if (!href) return;
// again, a simple check to make sure the link href is likely generated by us
const fields = href.replace(/[#?].*$/, '').split('/');
if (fields.length !== 4) return;

const [owner, repo, _issues, index] = fields;

const el = document.createElement('div');
el.className = 'ui custom popup hidden';
Expand Down

0 comments on commit f452c34

Please sign in to comment.