mirror of
https://github.com/Foundry376/Mailspring.git
synced 2024-11-10 17:48:50 +08:00
Fix insanely catastrophic backtracking when typing a link with a #hash and then “return” #
This change makes this part of the regexp “greedy and posessive”, meaning that if the regexp reaches the `$` end-of-string qualifier and it’s not the end of the string, it can’t go back and try to change the way it allocated characters to the regexp to make it work (infinitely.)
This commit is contained in:
parent
78268432c5
commit
1d2163c29a
1 changed files with 1 additions and 1 deletions
|
@ -167,7 +167,7 @@ const RegExpUtils = {
|
||||||
// optionally followed by: a query string and/or a #location
|
// optionally followed by: a query string and/or a #location
|
||||||
// (last character must not be puncation, hence two groups)
|
// (last character must not be puncation, hence two groups)
|
||||||
"(?:(\\?[\\-\\+=&;%@\\.\\w_\\#]*[\\#\\-\\+=&;%@\\w_\\/]+)?#?(?:['\\$\\&\\(\\)\\*\\+,;=\\.\\!\\/\\\\\\w%-?]*[\\/\\\\\\w]+)?)?",
|
"(?:(\\?[\\-\\+=&;%@\\.\\w_\\#]*[\\#\\-\\+=&;%@\\w_\\/]+)?#?(?:['\\$\\&\\(\\)\\*\\+,;=\\.\\!\\/\\\\\\w%-?]*[\\/\\\\\\w]+)?)?",
|
||||||
')?',
|
')?+',
|
||||||
')',
|
')',
|
||||||
];
|
];
|
||||||
if (matchStartOfString) {
|
if (matchStartOfString) {
|
||||||
|
|
Loading…
Reference in a new issue