Skip to content

Commit 184ee6e

Browse files
Make compatible with Helix 5 aem.page/live URLs (#89)
1 parent 11db31f commit 184ee6e

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

scripts/services/Link.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
const adaptToSiteUrlRegex = /^https?:\/\/([^/.]+--adaptto-website--adaptto.hlx.(page|live)|adapt.to|franklin.adaptto.de|localhost:\d+)(\/.+)$/;
2-
const adaptToSiteUrlPathnameGroup = 3;
1+
const adaptToSiteUrlRegex = /^https?:\/\/([^/.]+--adaptto-website--adaptto.(hlx|aem).(page|live)|adapt.to|localhost:\d+)(\/.+)$/;
2+
const adaptToSiteUrlPathnameGroup = 4;
33
const downloadUrlRegex = /^.+\.(pdf|zip)$/;
44

55
/**

test/scripts/services/LinkHandler.test.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ describe('services/LinkHandler', () => {
99
it('rewriteUrl', () => {
1010
expect(rewriteUrl('https://adapt.to/mypath')).to.eq('/mypath');
1111
expect(rewriteUrl('https://experimental-download-links--adaptto-website--adaptto.hlx.page/2021/schedule')).to.eq('/2021/schedule');
12+
expect(rewriteUrl('https://experimental-download-links--adaptto-website--adaptto.aem.page/2021/schedule')).to.eq('/2021/schedule');
1213
expect(rewriteUrl('https://main--adaptto-website--adaptto.hlx.live/2021/schedule#day1')).to.eq('/2021/schedule#day1');
1314
expect(rewriteUrl('https://localhost:2000/2021/schedule#day1')).to.eq('/2021/schedule#day1');
1415
expect(rewriteUrl('https://my.host.com/mypath')).to.eq('https://my.host.com/mypath');

0 commit comments

Comments
 (0)