fix(ui): discard partial archive on failed download (#1957)

This commit is contained in:
Oleg Shparber
2026-08-18 16:27:20 +03:00
committed by GitHub
parent e025a0a0dc
commit 454ad0b009
+10 -2
View File
@@ -310,6 +310,14 @@ void DocsetsDialog::processDownload(QNetworkReply *reply)
} }
if (reply->error() != QNetworkReply::OperationCanceledError) { if (reply->error() != QNetworkReply::OperationCanceledError) {
const auto type = downloadType(reply);
const QString docsetName = reply->property(DocsetNameProperty).toString();
// Downloads cannot be resumed, so a retry would append to whatever was received.
if (type == DownloadType::Docset) {
delete m_tmpFiles.take(docsetName);
}
const QString msg = tr("Download failed!<br><br><b>Error:</b> %1<br><b>URL:</b> %2") const QString msg = tr("Download failed!<br><br><b>Error:</b> %1<br><b>URL:</b> %2")
.arg(reply->errorString().toHtmlEscaped(), .arg(reply->errorString().toHtmlEscaped(),
reply->request().url().toString().toHtmlEscaped()); reply->request().url().toString().toHtmlEscaped());
@@ -320,8 +328,8 @@ void DocsetsDialog::processDownload(QNetworkReply *reply)
if (ret == QMessageBox::Retry) { if (ret == QMessageBox::Retry) {
enqueueDownload({.url = reply->request().url(), enqueueDownload({.url = reply->request().url(),
.type = downloadType(reply), .type = type,
.docsetName = reply->property(DocsetNameProperty).toString(), .docsetName = docsetName,
.listItemIndex = reply->property(ListItemIndexProperty).toInt()}); .listItemIndex = reply->property(ListItemIndexProperty).toInt()});
return; return;
} }