mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-01-31 19:02:59 +01:00
Exclude ?
, !
, and )
from last character of URL
Now the final character in each of these example strings is no longer considered part of the URL: * Have you seen http://example.com? * Look at http://example.com! * (see http://example.com)
This commit is contained in:
parent
7e8de5540f
commit
7d23278ed0
2 changed files with 2 additions and 2 deletions
|
@ -63,7 +63,7 @@ const urlRegex = (() => {
|
||||||
const urlChar = `[-:@_.,~%+/?=&#!;()$${wordCharRegex.source.slice(1, -1)}]`;
|
const urlChar = `[-:@_.,~%+/?=&#!;()$${wordCharRegex.source.slice(1, -1)}]`;
|
||||||
// Matches a single character that should not be considered part of the URL if it is the last
|
// Matches a single character that should not be considered part of the URL if it is the last
|
||||||
// character that matches urlChar.
|
// character that matches urlChar.
|
||||||
const postUrlPunct = '[:.,;]';
|
const postUrlPunct = '[:.,;?!)]';
|
||||||
// Schemes that must be followed by ://
|
// Schemes that must be followed by ://
|
||||||
const withAuth = `(?:${[
|
const withAuth = `(?:${[
|
||||||
'(?:x-)?man',
|
'(?:x-)?man',
|
||||||
|
|
|
@ -44,7 +44,7 @@ describe('urls', function () {
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('punctuation after URL is ignored', function () {
|
describe('punctuation after URL is ignored', function () {
|
||||||
for (const char of ':.,;]') {
|
for (const char of ':.,;?!)]') {
|
||||||
const want = 'https://etherpad.org';
|
const want = 'https://etherpad.org';
|
||||||
const input = want + char;
|
const input = want + char;
|
||||||
it(input, async function () {
|
it(input, async function () {
|
||||||
|
|
Loading…
Reference in a new issue