diff options
author | Alexey Rusakov <Kitsune-Ral@users.sf.net> | 2021-10-03 19:43:03 +0200 |
---|---|---|
committer | Alexey Rusakov <Kitsune-Ral@users.sf.net> | 2021-10-04 03:18:49 +0200 |
commit | bd71b075e699ab4dda92d72bac77cbfeb6217625 (patch) | |
tree | 1f19d8df755db23cb72a56678dbb43137325a449 /lib | |
parent | 4c3efb82b9f47ca92973089413da994619ddeb5c (diff) | |
download | libquotient-bd71b075e699ab4dda92d72bac77cbfeb6217625.tar.gz libquotient-bd71b075e699ab4dda92d72bac77cbfeb6217625.zip |
prettyPrint(): tighten up Matrix identifier regex
It was too permissive on characters before the identifier and also
allowed the domain name to start on dash, which should not occur.
Closes #512.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/util.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/util.cpp b/lib/util.cpp index 3de1d169..8067f561 100644 --- a/lib/util.cpp +++ b/lib/util.cpp @@ -44,7 +44,7 @@ void Quotient::linkifyUrls(QString& htmlEscapedText) // https://matrix.org/docs/spec/appendices.html#identifier-grammar static const QRegularExpression MxIdRegExp( QStringLiteral( - R"((^|[^<>/])([!#@][-a-z0-9_=#/.]{1,252}:(?:\w|\.|-)+\.\w+(?::\d{1,5})?))"), + R"((^|[][[:space:](){}`'";])([!#@][-a-z0-9_=#/.]{1,252}:\w(?:\w|\.|-)*\.\w+(?::\d{1,5})?))"), RegExpOptions); Q_ASSERT(FullUrlRegExp.isValid() && EmailAddressRegExp.isValid() && MxIdRegExp.isValid()); |