Skip to content

Commit

Permalink
Make compatible with Helix 5 aem.page/live URLs (#89)
Browse files Browse the repository at this point in the history
  • Loading branch information
stefanseifert authored Apr 16, 2024
1 parent 11db31f commit 184ee6e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
4 changes: 2 additions & 2 deletions scripts/services/Link.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const adaptToSiteUrlRegex = /^https?:\/\/([^/.]+--adaptto-website--adaptto.hlx.(page|live)|adapt.to|franklin.adaptto.de|localhost:\d+)(\/.+)$/;
const adaptToSiteUrlPathnameGroup = 3;
const adaptToSiteUrlRegex = /^https?:\/\/([^/.]+--adaptto-website--adaptto.(hlx|aem).(page|live)|adapt.to|localhost:\d+)(\/.+)$/;
const adaptToSiteUrlPathnameGroup = 4;
const downloadUrlRegex = /^.+\.(pdf|zip)$/;

/**
Expand Down
1 change: 1 addition & 0 deletions test/scripts/services/LinkHandler.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ describe('services/LinkHandler', () => {
it('rewriteUrl', () => {
expect(rewriteUrl('https://adapt.to/mypath')).to.eq('/mypath');
expect(rewriteUrl('https://experimental-download-links--adaptto-website--adaptto.hlx.page/2021/schedule')).to.eq('/2021/schedule');
expect(rewriteUrl('https://experimental-download-links--adaptto-website--adaptto.aem.page/2021/schedule')).to.eq('/2021/schedule');
expect(rewriteUrl('https://main--adaptto-website--adaptto.hlx.live/2021/schedule#day1')).to.eq('/2021/schedule#day1');
expect(rewriteUrl('https://localhost:2000/2021/schedule#day1')).to.eq('/2021/schedule#day1');
expect(rewriteUrl('https://my.host.com/mypath')).to.eq('https://my.host.com/mypath');
Expand Down

0 comments on commit 184ee6e

Please sign in to comment.