detect recursive redirects (#6570)

* detect recursive redirects

* handle failure with normal failure handler
This commit is contained in:
ebbit1q 2026-01-25 22:05:19 +01:00 committed by GitHub
parent c02cf5e89e
commit 303bd8b607
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -70,16 +70,22 @@ 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();
if (redirectUrl.isRelative()) {
redirectUrl = url.resolved(redirectUrl);
}
emit urlRedirected(url, redirectUrl);
if (url == redirectUrl) {
qCWarning(CardPictureLoaderWorkerWorkLog) << "recusive redirect detected!";
redirectFailure = true;
} else {
emit urlRedirected(url, redirectUrl);
}
}
if (reply->error()) {
if (redirectFailure || reply->error()) {
handleFailedReply(reply);
} else {
handleSuccessfulReply(reply);