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

Flatten ImageObject to URL

We don't really use ImageObject's additional properties (caption, EXIF data, etc) anywhere right now,
so flatten it to a URL so it "just works" for most consumers.

Differential Revision:
parent 8cb57b6c
......@@ -329,10 +329,18 @@ QJsonObject JsonLdImportFilter::filterObject(const QJsonObject& obj)
res.insert(QStringLiteral("potentialAction"), filterActions(actions));
const auto image = res.value(QLatin1String("image"));
auto image = res.value(QLatin1String("image"));
if (image.isArray()) {
res.insert(QStringLiteral("image"), image.toArray().first());
image = res.value(QLatin1String("image"));
if (image.isObject()) {
const auto imageObject = image.toObject();
if (imageObject.value(QLatin1String("@type")).toString() == QLatin1String("ImageObject")) {
res.insert(QStringLiteral("image"), imageObject.value(QLatin1String("url")));
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