Skip to content

Commit

Permalink
fix(html-resource-plugin): handle query string and mixed casing
Browse files Browse the repository at this point in the history
Fixes #203
  • Loading branch information
jdanyow committed Mar 28, 2016
1 parent 8067068 commit 86afdd8
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 7 deletions.
8 changes: 1 addition & 7 deletions src/html-resource-plugin.js
Expand Up @@ -2,13 +2,7 @@ import {ViewEngine} from 'aurelia-templating';
import {_createDynamicElement} from './dynamic-element';

export function getElementName(address) {
let elementName = address.replace('.html', '');
let index = elementName.lastIndexOf('/');

if (index !== 0) {
elementName = elementName.substring(index + 1);
}
return elementName;
return /([^\/^\?]+)\.html/i.exec(address)[1].toLowerCase();
}

export function configure(config) {
Expand Down
1 change: 1 addition & 0 deletions test/html-resource-plugin.spec.js
Expand Up @@ -3,6 +3,7 @@ import {getElementName} from '../src/html-resource-plugin';
describe('html-resource-plugin', () => {
it('computes element name', () => {
expect(getElementName('foo.html')).toBe('foo');
expect(getElementName('FOO.HTML')).toBe('foo');
expect(getElementName('/foo.html')).toBe('foo');
expect(getElementName('bar/foo.html')).toBe('foo');
expect(getElementName('foo.html?bar')).toBe('foo');
Expand Down

0 comments on commit 86afdd8

Please sign in to comment.