Skip to content

Commit f452c34

Browse files
committed
Fix context popup error
1 parent 23d3692 commit f452c34

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

web_src/js/features/contextpopup.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,15 @@ export default function initContextPopups() {
1010
if ($(this).hasClass('ref-external-issue')) {
1111
return;
1212
}
13-
const [index, _issues, repo, owner] = $(this).attr('href').replace(/[#?].*$/, '').split('/').reverse();
13+
14+
// some links were not generated by us and may lack the href attribute
15+
const href = $(this).attr('href');
16+
if (!href) return;
17+
// again, a simple check to make sure the link href is likely generated by us
18+
const fields = href.replace(/[#?].*$/, '').split('/');
19+
if (fields.length !== 4) return;
20+
21+
const [owner, repo, _issues, index] = fields;
1422

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

0 commit comments

Comments
 (0)