mirror of
https://github.com/zealdocs/zeal.git
synced 2026-08-29 08:34:50 +08:00
fix(ui): discard partial archive on failed download (#1957)
This commit is contained in:
@@ -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;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user