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.
This commit is contained in:
parent
a8a403872d
commit
6631e1afa2
1 changed files with 20 additions and 0 deletions
|
@ -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):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue