Skip to content

Commit

Permalink
Merge 2efd28a into f3cd652
Browse files Browse the repository at this point in the history
  • Loading branch information
jrkong committed Oct 29, 2018
2 parents f3cd652 + 2efd28a commit 7206210
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
24 changes: 24 additions & 0 deletions src/addons/webLinks/webLinks.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,28 @@ describe('webLinks addon', () => {

assert.equal(uri, 'http://foo.com/a~b#c~d?e~f');
});

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

const row = ' http://foo.com/colon:test ';

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

assert.equal(uri, 'http://foo.com/colon:test');
});

it('should not allow : character at the end of a URI path', () => {
const term = new MockTerminal();
webLinks.webLinksInit(<any>term);

const row = ' http://foo.com/colon:test: ';

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

assert.equal(uri, 'http://foo.com/colon:test');
});
});
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 pathClause = '(\\/[\\/\\w\\.\\-%~]*)*';
const pathClause = '(\\/[\\/\\w\\.\\-%~:]*)*([^:\\s])';
const queryStringHashFragmentCharacterSet = '[0-9\\w\\[\\]\\(\\)\\/\\?\\!#@$%&\'*+,:;~\\=\\.\\-]*';
const queryStringClause = '(\\?' + queryStringHashFragmentCharacterSet + ')?';
const hashFragmentClause = '(#' + queryStringHashFragmentCharacterSet + ')?';
Expand Down

0 comments on commit 7206210

Please sign in to comment.