Skip to content

Commit

Permalink
chore: fix condition on replacing links to skip outside domains
Browse files Browse the repository at this point in the history
  • Loading branch information
ztsorojev committed Jun 15, 2022
1 parent 9ff839a commit 0fffa7f
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion api/services/TopicService.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,9 @@ module.exports = {
var topicName = $(elem).text();
var rdOptions = $(elem).attr('rd-options');
if(!current) return;
var absolutePattern = /^https?:\/\//i;
var rdrrPattern = /rdrr.io/i;
if (!rdrrPattern.test(current)) return;
if (absolutePattern.test(current) && !rdrrPattern.test(current)) return;
if (rdOptions === '' || !rdOptions) {
$(elem).attr('href', url.resolve(basePath, encodeURIComponent(topicName)) +
'?package=' + encodeURIComponent(packageVersion.package_name) +
Expand Down

0 comments on commit 0fffa7f

Please sign in to comment.