From: Christian Kamm Date: Thu, 4 May 2017 13:12:14 +0000 (+0200) Subject: Downloads: Remove empty temporary if disk space full #5746 X-Git-Tag: archive/raspbian/3.16.7-1_deb13u1+rpi1~1^2~755 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=aff8008bafb6af1f49b7ed7e9e019383cf43483b;p=nextcloud-desktop.git Downloads: Remove empty temporary if disk space full #5746 --- diff --git a/src/libsync/propagatedownload.cpp b/src/libsync/propagatedownload.cpp index a21deb3d0..823c491d9 100644 --- a/src/libsync/propagatedownload.cpp +++ b/src/libsync/propagatedownload.cpp @@ -372,16 +372,23 @@ void PropagateDownloadFile::start() // If there's not enough space to fully download this file, stop. const auto diskSpaceResult = propagator()->diskSpaceCheck(); - if (diskSpaceResult == OwncloudPropagator::DiskSpaceFailure) { - _item->_errorMayBeBlacklisted = true; - done(SyncFileItem::NormalError, - tr("The download would reduce free disk space below %1").arg( - Utility::octetsToString(freeSpaceLimit()))); - return; - } else if (diskSpaceResult == OwncloudPropagator::DiskSpaceCritical) { - done(SyncFileItem::FatalError, - tr("Free space on disk is less than %1").arg( - Utility::octetsToString(criticalFreeSpaceLimit()))); + if (diskSpaceResult != OwncloudPropagator::DiskSpaceOk) { + if (diskSpaceResult == OwncloudPropagator::DiskSpaceFailure) { + _item->_errorMayBeBlacklisted = true; + done(SyncFileItem::NormalError, + tr("The download would reduce free disk space below %1").arg( + Utility::octetsToString(freeSpaceLimit()))); + } else if (diskSpaceResult == OwncloudPropagator::DiskSpaceCritical) { + done(SyncFileItem::FatalError, + tr("Free space on disk is less than %1").arg( + Utility::octetsToString(criticalFreeSpaceLimit()))); + } + + // Remove the temporary, if empty. + if (_resumeStart == 0) { + _tmpFile.remove(); + } + return; }