Skip to content

Commit

Permalink
Merge pull request #2046 from NizamLZ/fix/2045
Browse files Browse the repository at this point in the history
Allow + char in URI path
  • Loading branch information
Tyriar authored May 9, 2019
2 parents ffc868a + 4875362 commit d363416
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 1 deletion.
26 changes: 26 additions & 0 deletions src/addons/webLinks/webLinks.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -183,4 +183,30 @@ describe('webLinks addon', () => {
assert.equal(uri, 'http://bar.io/');
});
});

describe('should allow + character in URI path', () => {
it('foo.com', () => {
const term = new MockTerminal();
webLinks.webLinksInit(<any>term);

const row = 'http://foo.com/subpath/+/id';

const match = row.match(term.regex);
const uri = match[term.options.matchIndex];

assert.equal(uri, 'http://foo.com/subpath/+/id');
});

it('bar.io', () => {
const term = new MockTerminal();
webLinks.webLinksInit(<any>term);

const row = 'http://bar.io/subpath/+/id';

const match = row.match(term.regex);
const uri = match[term.options.matchIndex];

assert.equal(uri, 'http://bar.io/subpath/+/id');
});
});
});
2 changes: 1 addition & 1 deletion src/addons/webLinks/webLinks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const ipClause = '((\\d{1,3}\\.){3}\\d{1,3})';
const localHostClause = '(localhost)';
const portClause = '(:\\d{1,5})';
const hostClause = '((' + domainBodyClause + '\\.' + tldClause + ')|' + ipClause + '|' + localHostClause + ')' + portClause + '?';
const pathCharacterSet = '(\\/[\\/\\w\\.\\-%~:]*)*([^:"\'\\s])';
const pathCharacterSet = '(\\/[\\/\\w\\.\\-%~:+]*)*([^:"\'\\s])';
const pathClause = '(' + pathCharacterSet + ')?';
const queryStringHashFragmentCharacterSet = '[0-9\\w\\[\\]\\(\\)\\/\\?\\!#@$%&\'*+,:;~\\=\\.\\-]*';
const queryStringClause = '(\\?' + queryStringHashFragmentCharacterSet + ')?';
Expand Down

0 comments on commit d363416

Please sign in to comment.