in src/utils/urls.js [9:31]
export function getBugLinkTitle(ref) {
// return a shortened URL for bugzilla and github URLs.
// also copied from the Glean Dictionary
const url = getBugURL(ref);
// bugzilla bugs
if (url.includes('bugzilla.mozilla.org') || url.includes('bugzil.la')) {
return url.replace(/([^\d]+)/, 'bugzil.la/');
}
// github issues or pull requests
if (url.includes('github.com')) {
return url
.replace(
/[^\d]+\/([^\d]+)\/([^\d]+)\/[^\d]+\/([\d]+)/,
(_, orgName, repoName, issueNumber) =>
`${orgName}/${repoName}#${issueNumber}`
)
.replace(/#issuecomment.*/, '-comment');
}
// some other hitherto unseen issue URL, we'll just return
// it verbatim, just remove the http/https part
return url.replace(/^http(s?):\/\//, '');
}