Merge pull request #4663 from Zahnstocher/storage_leak_fix

Storage leak download fix #4656
This commit is contained in:
vshcherb 2017-10-30 17:50:56 +01:00 committed by GitHub
commit 9ee6dd03e8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -213,7 +213,11 @@ public class DownloadFileHelper {
}
unzipFile(de, progress, downloadInputStreams);
if(!de.targetFile.getAbsolutePath().equals(de.fileToDownload.getAbsolutePath())){
Algorithms.removeAllFiles(de.targetFile);
boolean successfull = Algorithms.removeAllFiles(de.targetFile);
if (successfull) {
ctx.getResourceManager().closeFile(de.targetFile.getName());
}
boolean renamed = de.fileToDownload.renameTo(de.targetFile);
if(!renamed) {
showWarningCallback.showWarning(ctx.getString(R.string.shared_string_io_error) + ": old file can't be deleted");