Commit 6631e1af authored by Luca Beltrame's avatar Luca Beltrame

Add scheme to thumbnailUrl if missing

Konachan.com started offering preview URLs as // to accomodate
for both HTTP and HTTPS: this however broke preview loading and also
downloading.

For now http is prepended to schemaless URLs. An addition would be to
offer things via https and adjust the scheme depending on that.
parent a8a40387
......@@ -59,11 +59,31 @@ DanbooruPost::DanbooruPost(QVariantMap postData, QPixmap pixmap,
m_width = postData.value(QStringLiteral("width")).toString().toInt();
m_url = postData.value(QStringLiteral("file_url")).toUrl();
if (m_url.scheme().isEmpty()) {
// Konachan.com offers // for both http and https, but this
// just creates schemaless URLs
m_url.setScheme("http");
}
m_thumbnailUrl = postData.value(QStringLiteral("preview_url")).toUrl();
if(m_thumbnailUrl.scheme().isEmpty()) {
// Konachan.com offers // for both http and https, but this
// just creates schemaless URLs
m_thumbnailUrl.setScheme("http");
}
m_size = postData.value(QStringLiteral("file_size")).toInt();
m_rating = RATING_MAP.value(postData.value(QStringLiteral("rating")).toString());
m_sampleUrl = postData.value(QStringLiteral("sample_url")).toUrl();
if (m_sampleUrl.scheme().isEmpty()) {
// Konachan.com offers // for both http and https, but this
// just creates schemaless URLs
m_sampleUrl.setScheme("http");
}
}
DanbooruPost::DanbooruPost(QXmlStreamAttributes &postData, QPixmap pixmap, QObject *parent):
......
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