Skip to content

Commit 0fffa7f

Browse files
committed
chore: fix condition on replacing links to skip outside domains
1 parent 9ff839a commit 0fffa7f

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

api/services/TopicService.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,9 @@ module.exports = {
1515
var topicName = $(elem).text();
1616
var rdOptions = $(elem).attr('rd-options');
1717
if(!current) return;
18+
var absolutePattern = /^https?:\/\//i;
1819
var rdrrPattern = /rdrr.io/i;
19-
if (!rdrrPattern.test(current)) return;
20+
if (absolutePattern.test(current) && !rdrrPattern.test(current)) return;
2021
if (rdOptions === '' || !rdOptions) {
2122
$(elem).attr('href', url.resolve(basePath, encodeURIComponent(topicName)) +
2223
'?package=' + encodeURIComponent(packageVersion.package_name) +

0 commit comments

Comments
 (0)