Commit 9513c6b5 authored by Kai Uwe Broulik's avatar Kai Uwe Broulik 🍇
Browse files

When image is an Array, take the first one

Itinerary expects image as a QUrl, so when a websites uses an Array with multiple images
(not sure how compliant that is but very common), at least take the first one so we have something to show.

Differential Revision: https://phabricator.kde.org/D27600
parent d36a4228
......@@ -311,5 +311,10 @@ QJsonObject JsonLdImportFilter::filterObject(const QJsonObject& obj)
res.insert(QStringLiteral("potentialAction"), filterActions(actions));
}
const auto image = res.value(QLatin1String("image"));
if (image.isArray()) {
res.insert(QStringLiteral("image"), image.toArray().first());
}
return res;
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment