mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-07-08 17:13:57 -07:00
handle failure with normal failure handler
This commit is contained in:
parent
2dd6e4db43
commit
bb56947128
1 changed files with 3 additions and 5 deletions
|
|
@ -70,6 +70,7 @@ void CardPictureLoaderWorkerWork::picDownloadFailed()
|
||||||
void CardPictureLoaderWorkerWork::handleNetworkReply(QNetworkReply *reply)
|
void CardPictureLoaderWorkerWork::handleNetworkReply(QNetworkReply *reply)
|
||||||
{
|
{
|
||||||
QVariant redirectTarget = reply->attribute(QNetworkRequest::RedirectionTargetAttribute);
|
QVariant redirectTarget = reply->attribute(QNetworkRequest::RedirectionTargetAttribute);
|
||||||
|
bool redirectFailure = false;
|
||||||
if (redirectTarget.isValid()) {
|
if (redirectTarget.isValid()) {
|
||||||
QUrl url = reply->request().url();
|
QUrl url = reply->request().url();
|
||||||
QUrl redirectUrl = redirectTarget.toUrl();
|
QUrl redirectUrl = redirectTarget.toUrl();
|
||||||
|
|
@ -78,16 +79,13 @@ void CardPictureLoaderWorkerWork::handleNetworkReply(QNetworkReply *reply)
|
||||||
}
|
}
|
||||||
if (url == redirectUrl) {
|
if (url == redirectUrl) {
|
||||||
qCWarning(CardPictureLoaderWorkerWorkLog) << "recusive redirect detected!";
|
qCWarning(CardPictureLoaderWorkerWorkLog) << "recusive redirect detected!";
|
||||||
qCWarning(CardPictureLoaderWorkerWorkLog) << "refusing to load" << redirectTarget;
|
redirectFailure = true;
|
||||||
reply->deleteLater();
|
|
||||||
picDownloadFailed();
|
|
||||||
return;
|
|
||||||
} else {
|
} else {
|
||||||
emit urlRedirected(url, redirectUrl);
|
emit urlRedirected(url, redirectUrl);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (reply->error()) {
|
if (redirectFailure || reply->error()) {
|
||||||
handleFailedReply(reply);
|
handleFailedReply(reply);
|
||||||
} else {
|
} else {
|
||||||
handleSuccessfulReply(reply);
|
handleSuccessfulReply(reply);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue