Skip to content

Commit

Permalink
MWPW-140660 Fix Marketo Destination Url
Browse files Browse the repository at this point in the history
  • Loading branch information
meganthecoder committed Jan 4, 2024
1 parent 89c5bd7 commit ab62824
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion libs/blocks/marketo/marketo.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export const decorateURL = (destination, baseURL = window.location) => {
destinationUrl = new URL(`${pathname}${search}${hash}`, baseURL.origin);
}

if (baseURL.pathname.endsWith('.html') && !pathname.endsWith('.html')) {
if (baseURL.pathname.endsWith('.html') && !pathname.endsWith('.html') && !pathname.endsWith('/')) {
destinationUrl.pathname = `${pathname}.html`;
}

Expand Down
6 changes: 6 additions & 0 deletions test/blocks/marketo/marketo.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,4 +77,10 @@ describe('marketo decorateURL', () => {
const result = decorateURL('tps://business', baseURL);
expect(result).to.be.null;
});

it('Does not add .html to ending slash', () => {
const baseURL = new URL('https://business.adobe.com/marketo-block.html');
const result = decorateURL('https://business.adobe.com/', baseURL);
expect(result.href).to.equal('https://business.adobe.com/');
});
});

0 comments on commit ab62824

Please sign in to comment.