1
0
Fork 0
mirror of https://git.jami.net/savoirfairelinux/jami-client-qt.git synced 2025-09-03 13:43:34 +02:00

link-previews: strip Windows EOLs too when parsing meta tags

Change-Id: I54cd44a3ef388321c411b7c45985aa1808d380c8
This commit is contained in:
Andreas Traczyk 2023-05-18 10:06:29 -04:00
parent 1b51dcc8e6
commit 6ce57d6a90

View file

@ -27,7 +27,8 @@ getInnerHtml(const QString& tag)
return match.hasMatch() ? match.captured(1) : QString {};
};
const QRegularExpression PreviewEngine::newlineRe("\\n");
// Portable newline regex.
const QRegularExpression PreviewEngine::newlineRe("\\r?\\n");
PreviewEngine::PreviewEngine(ConnectivityMonitor* cm, QObject* parent)
: NetworkManager(cm, parent)
@ -83,7 +84,6 @@ PreviewEngine::getDescription(HtmlParser::TagInfoList& metaTags)
QString
PreviewEngine::getImage(HtmlParser::TagInfoList& metaTags)
{
static const QRegularExpression newlineRe("\\n");
// Try with og/twitter props
QString image = getTagContent(metaTags[TidyTag_META], "image");
if (image.isEmpty()) { // Try with href of link tag (rel="image_src")