Add support for square brackets in URLs

This reverts commit 9022877cc6.
This commit is contained in:
Richard Hansen 2021-07-03 18:19:26 -04:00
parent 09f8ffbdb6
commit 336d48add7
2 changed files with 4 additions and 21 deletions

View file

@ -60,10 +60,10 @@ const wordCharRegex = new RegExp(`[${[
const urlRegex = (() => {
// TODO: wordCharRegex matches many characters that are not permitted in URIs. Are they included
// here as an attempt to support IRIs? (See https://tools.ietf.org/html/rfc3987.)
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
// character that matches urlChar.
const postUrlPunct = '[:.,;?!)\'*]';
const postUrlPunct = '[:.,;?!)\\]\'*]';
// Schemes that must be followed by ://
const withAuth = `(?:${[
'(?:x-)?man',