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) 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);