Skip to content

Commit

Permalink
Merge pull request #67 from adobe/issue/modelpath
Browse files Browse the repository at this point in the history
fix: fix html extension regex
  • Loading branch information
sharanyavinod authored Jul 14, 2021
2 parents 052be87 + e8eec9f commit 63a5098
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/PathUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ export class PathUtils {
const selectors = slingElementsWithoutResource[0].split('.');
let currentExtension = selectors.pop();

currentExtension = currentExtension ? currentExtension.replace(/\.htm(l)?/, '') : '';
currentExtension = currentExtension ? currentExtension.replace(/htm(l)?/, '') : '';

let path = selectors.join('.') + '.' + currentExtension + extension;

Expand Down
1 change: 1 addition & 0 deletions test/PathUtils.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -403,6 +403,7 @@ describe('PathUtils ->', () => {
assert.equal(PathUtils.addExtension('/foobar.json', 'json'), '/foobar.json');
assert.equal(PathUtils.addExtension('/foobar', 'json'), '/foobar.json');
assert.equal(PathUtils.addExtension('/foobar#test123fragment', 'model.json'), '/foobar.model.json');
assert.equal(PathUtils.addExtension('/foobar.model.html', 'json'), '/foobar.model.json');
});

it('addSelector', () => {
Expand Down

0 comments on commit 63a5098

Please sign in to comment.