Skip to content
Snippets Groups Projects
Commit 6ce57d6a authored by Andreas Traczyk's avatar Andreas Traczyk
Browse files

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

Change-Id: I54cd44a3ef388321c411b7c45985aa1808d380c8
parent 1b51dcc8
No related branches found
No related tags found
No related merge requests found
...@@ -27,7 +27,8 @@ getInnerHtml(const QString& tag) ...@@ -27,7 +27,8 @@ getInnerHtml(const QString& tag)
return match.hasMatch() ? match.captured(1) : QString {}; 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) PreviewEngine::PreviewEngine(ConnectivityMonitor* cm, QObject* parent)
: NetworkManager(cm, parent) : NetworkManager(cm, parent)
...@@ -83,7 +84,6 @@ PreviewEngine::getDescription(HtmlParser::TagInfoList& metaTags) ...@@ -83,7 +84,6 @@ PreviewEngine::getDescription(HtmlParser::TagInfoList& metaTags)
QString QString
PreviewEngine::getImage(HtmlParser::TagInfoList& metaTags) PreviewEngine::getImage(HtmlParser::TagInfoList& metaTags)
{ {
static const QRegularExpression newlineRe("\\n");
// Try with og/twitter props // Try with og/twitter props
QString image = getTagContent(metaTags[TidyTag_META], "image"); QString image = getTagContent(metaTags[TidyTag_META], "image");
if (image.isEmpty()) { // Try with href of link tag (rel="image_src") if (image.isEmpty()) { // Try with href of link tag (rel="image_src")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment