Skip to content

Commit

Permalink
fix: revert recent changes
Browse files Browse the repository at this point in the history
  • Loading branch information
fczbkk committed Jul 17, 2016
1 parent 087ff6e commit 432b5fe
Show file tree
Hide file tree
Showing 4 changed files with 0 additions and 21 deletions.
4 changes: 0 additions & 4 deletions lib/path.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,6 @@ var _class = function (_UrlPart) {
key: 'sanitize_replacements',
get: function get() {
return [
// add trailing slash if path is empty
{ substring: /^$/, replacement: '\/' },
// add trailing slash if path does not end with asterisk or trailing slash
{ substring: /[^/*]$/, replacement: '$&\/' },
// assume trailing slash at the end of path is optional
{ substring: /\/$/, replacement: '\\/?' }, { substring: /\/\*$/, replacement: '((\/?)|\/*)' },
// allow letters, numbers, hyphens, dots, slashes and underscores
Expand Down
4 changes: 0 additions & 4 deletions src/path.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,6 @@ export default class extends UrlPart {

get sanitize_replacements () {
return [
// add trailing slash if path is empty
{substring: /^$/, replacement: '\/'},
// add trailing slash if path does not end with asterisk or trailing slash
{substring: /[^/*]$/, replacement: '$&\/'},
// assume trailing slash at the end of path is optional
{substring: /\/$/, replacement: '\\/?'},
{substring: /\/\*$/, replacement: '((\/?)|\/*)'},
Expand Down
6 changes: 0 additions & 6 deletions test/path.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,12 +72,6 @@ describe('Path', function() {
expect(path.test('bbb.ccc', path.sanitize('*/*.ccc'))).toBe(false);
});

it('should add trailing slash if missing', function () {
expect(path.test('/', path.sanitize(''))).toBe(true);
expect(path.test('aaa/', path.sanitize('aaa'))).toBe(true);
expect(path.test('aaa/bbb/', path.sanitize('aaa/bbb'))).toBe(true);
});

it('should assume trailing `/` is optional', function() {
expect(path.test('', path.sanitize('/'))).toBe(true);
expect(path.test('aaa', path.sanitize('aaa/'))).toBe(true);
Expand Down
7 changes: 0 additions & 7 deletions test/real-life-examples.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,11 +90,4 @@ describe('Real life examples', function() {
expect(my_match.test('http://localhost:3000/aaa/bbb')).toBe(true);
});

it('should handle missing trailing slash', function () {
const my_match = new UrlMatch('*://*/ccc');
expect(my_match.test('http://aaa.bbb/ccc')).toBe(true);
expect(my_match.test('http://aaa.bbb/ccc/')).toBe(true);
expect(my_match.test('http://aaa.bbb/ccc/ddd')).toBe(false);
});

});

0 comments on commit 432b5fe

Please sign in to comment.