From c111f8bef466e26a6c408faf496ba6233ef2f397 Mon Sep 17 00:00:00 2001 From: Steve Larson <9larsons@gmail.com> Date: Tue, 7 Mar 2023 13:35:34 -0600 Subject: [PATCH] :bug: Fixed referrals to web archive no refs -removed ref param for archive.org domain -ref links to archive.org were broken --- ghost/member-attribution/lib/outbound-link-tagger.js | 4 +++- ghost/member-attribution/test/outbound-link-tagger.test.js | 5 +++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/ghost/member-attribution/lib/outbound-link-tagger.js b/ghost/member-attribution/lib/outbound-link-tagger.js index 25b0e34538..d5b8346ef0 100644 --- a/ghost/member-attribution/lib/outbound-link-tagger.js +++ b/ghost/member-attribution/lib/outbound-link-tagger.js @@ -4,7 +4,9 @@ const LinkReplacer = require('@tryghost/link-replacer'); const blockedReferrerDomains = [ // Facebook has some restrictions on the 'ref' attribute (max 15 chars + restricted character set) that breaks links if we add ?ref=longer-string 'facebook.com', - 'www.facebook.com' + 'www.facebook.com', + 'web.archive.org', + 'archive.org' ]; /** diff --git a/ghost/member-attribution/test/outbound-link-tagger.test.js b/ghost/member-attribution/test/outbound-link-tagger.test.js index 51ddda6c5a..b763a888ec 100644 --- a/ghost/member-attribution/test/outbound-link-tagger.test.js +++ b/ghost/member-attribution/test/outbound-link-tagger.test.js @@ -82,6 +82,11 @@ describe('OutboundLinkTagger', function () { const updatedUrl = await service.addToUrl(url); should(updatedUrl.toString()).equal('https://facebook.com/'); + + const urlTwo = new URL('https://web.archive.org/'); + const updatedUrlTwo = await service.addToUrl(urlTwo); + + should(updatedUrlTwo.toString()).equal('https://web.archive.org/'); }); it('does not add ref if utm_source is present', async function () {