1
0
mirror of https://github.com/fabianonline/telegram_backup.git synced 2024-12-25 22:35:35 +00:00

Delete files with too less bytes.

This commit is contained in:
Fabian Schlenz 2016-07-04 09:35:40 +02:00
parent 45e3e22ef3
commit 293e77636e

View File

@ -275,11 +275,12 @@ class DownloadManager {
fos.write(response.getBytes().getData());
try { Thread.sleep(Config.DELAY_AFTER_GET_FILE); } catch(InterruptedException e) {}
} while(offset < size && response.getBytes().getData().length>0);
fos.close();
if (offset < size) {
System.out.println("Requested file " + target + " with " + size + " bytes, but got only " + offset + " bytes.");
new File(target).delete();
System.exit(1);
}
fos.close();
return true;
} catch (java.io.IOException ex) {
if (fos!=null) fos.close();