handle failure with normal failure handler

This commit is contained in:
ebbit1q 2026-01-25 19:07:27 +01:00
parent 2dd6e4db43
commit bb56947128

View file

@ -70,6 +70,7 @@ void CardPictureLoaderWorkerWork::picDownloadFailed()
void CardPictureLoaderWorkerWork::handleNetworkReply(QNetworkReply *reply)
{
QVariant redirectTarget = reply->attribute(QNetworkRequest::RedirectionTargetAttribute);
bool redirectFailure = false;
if (redirectTarget.isValid()) {
QUrl url = reply->request().url();
QUrl redirectUrl = redirectTarget.toUrl();
@ -78,16 +79,13 @@ void CardPictureLoaderWorkerWork::handleNetworkReply(QNetworkReply *reply)
}
if (url == redirectUrl) {
qCWarning(CardPictureLoaderWorkerWorkLog) << "recusive redirect detected!";
qCWarning(CardPictureLoaderWorkerWorkLog) << "refusing to load" << redirectTarget;
reply->deleteLater();
picDownloadFailed();
return;
redirectFailure = true;
} else {
emit urlRedirected(url, redirectUrl);
}
}
if (reply->error()) {
if (redirectFailure || reply->error()) {
handleFailedReply(reply);
} else {
handleSuccessfulReply(reply);