Special-case and handle reported corrupt bug reports

This commit is contained in:
baldurk
2026-02-13 13:06:06 +00:00
parent e3b4ff8395
commit c67969d6ce
2 changed files with 26 additions and 3 deletions
+24 -3
View File
@@ -488,8 +488,22 @@ void CrashDialog::sendReport()
m_Request, OverloadedSlot<QNetworkReply::NetworkError>::of(&QNetworkReply::error),
[this](QNetworkReply::NetworkError err) {
ui->progressBar->setValue(0);
ui->progressText->setText(tr("Network error uploading:\n%1").arg(m_Request->errorString()));
ui->uploadRetry->setEnabled(true);
if(m_Request->error() == QNetworkReply::ProtocolInvalidOperationError)
{
ui->progressText->setText(
tr("Server reported that the crash report is corrupted.\n\n"
"Check that your program is not passing garbage/corrupted strings to "
"the API in e.g. names or messages.\n\n"
"This could also be caused by disk I/O corruption leading to garbage bytes."));
ui->uploadRetry->setEnabled(false);
ui->uploadCancel->setText(tr("Close"));
m_Corrupted = true;
}
else
{
ui->progressText->setText(tr("Network error uploading:\n%1").arg(m_Request->errorString()));
ui->uploadRetry->setEnabled(true);
}
});
ui->progressBar->setValue(0);
@@ -507,7 +521,7 @@ void CrashDialog::sendReport()
QObject::connect(m_Request, &QNetworkReply::finished, [this]() {
// don't do anything if we're finished after an error
if(ui->uploadRetry->isEnabled())
if(ui->uploadRetry->isEnabled() || m_Corrupted)
return;
QString text = tr("<p>Your report has been uploaded, thank you for your help!</p>");
@@ -538,6 +552,13 @@ void CrashDialog::on_cancel_clicked()
void CrashDialog::on_uploadCancel_clicked()
{
// if the report is corrupt don't bother checking with the user - there is nothing they can do
if(m_Corrupted)
{
reject();
return;
}
// check that it wasn't an accident
QMessageBox::StandardButton result = RDDialog::question(
this, tr("Cancel upload?"), tr("Are you sure you want to cancel the bug report upload?"));