fix link parser

This commit is contained in:
Rasmus Karlsson 2018-06-29 10:22:09 +02:00
parent 712a292d7e
commit ec4c243455

View file

@ -10,6 +10,7 @@ namespace chatterino {
LinkParser::LinkParser(const QString &unparsedString) LinkParser::LinkParser(const QString &unparsedString)
{ {
static QRegularExpression linkRegex = [] { static QRegularExpression linkRegex = [] {
static QRegularExpression newLineRegex("\r?\n");
QFile tldFile(":/tlds.txt"); QFile tldFile(":/tlds.txt");
tldFile.open(QFile::ReadOnly); tldFile.open(QFile::ReadOnly);
@ -17,7 +18,7 @@ LinkParser::LinkParser(const QString &unparsedString)
t1.setCodec("UTF-8"); t1.setCodec("UTF-8");
// Read the TLDs in and replace the newlines with pipes // Read the TLDs in and replace the newlines with pipes
QString tldData = t1.readAll().replace("\n", "|"); QString tldData = t1.readAll().replace(newLineRegex, "|");
const QString urlRegExp = const QString urlRegExp =
"^" "^"