allow URL redirects
This commit is contained in:
parent
183fbd2805
commit
8a86165890
1 changed files with 9 additions and 0 deletions
|
@ -448,6 +448,15 @@ void PictureLoader::picDownloadFinished(QNetworkReply *reply)
|
||||||
qDebug() << "Download failed:" << reply->errorString();
|
qDebug() << "Download failed:" << reply->errorString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int statusCode = reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt();
|
||||||
|
if (statusCode == 301 || statusCode == 302) {
|
||||||
|
QUrl redirectUrl = reply->attribute(QNetworkRequest::RedirectionTargetAttribute).toUrl();
|
||||||
|
QNetworkRequest req(redirectUrl);
|
||||||
|
qDebug() << "following redirect:" << cardBeingDownloaded.getCard()->getName() << "Url:" << req.url();
|
||||||
|
networkManager->get(req);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const QByteArray &picData = reply->peek(reply->size()); //peek is used to keep the data in the buffer for use by QImageReader
|
const QByteArray &picData = reply->peek(reply->size()); //peek is used to keep the data in the buffer for use by QImageReader
|
||||||
|
|
||||||
// check if the image is blacklisted
|
// check if the image is blacklisted
|
||||||
|
|
Loading…
Reference in a new issue