1
0
mirror of https://github.com/RipMeApp/ripme.git synced 2025-08-13 17:34:13 +02:00

Merge pull request #989 from cyian-1756/downloaderCleanUp

Moved if statement outide of loop
This commit is contained in:
cyian-1756
2018-10-14 15:15:03 -05:00
committed by GitHub

View File

@@ -228,7 +228,11 @@ class DownloadFileThread extends Thread {
}
byte[] data = new byte[1024 * 256];
int bytesRead;
boolean shouldSkipFileDownload = huc.getContentLength() / 10000000 >= 10;
boolean shouldSkipFileDownload = huc.getContentLength() / 10000000 >= 10 && AbstractRipper.isThisATest();
// If this is a test rip we skip large downloads
if (shouldSkipFileDownload) {
logger.debug("Not downloading whole file because it is over 10mb and this is a test");
} else {
while ((bytesRead = bis.read(data)) != -1) {
try {
observer.stopCheck();
@@ -242,13 +246,6 @@ class DownloadFileThread extends Thread {
observer.setBytesCompleted(bytesDownloaded);
observer.sendUpdate(STATUS.COMPLETED_BYTES, bytesDownloaded);
}
// If this is a test and we're downloading a large file
if (AbstractRipper.isThisATest() && shouldSkipFileDownload) {
logger.debug("Not downloading whole file because it is over 10mb and this is a test");
bis.close();
fos.close();
break;
}
}
bis.close();