|
@@ -101,6 +101,7 @@ public class VideoDownloader {
|
|
|
|
|
|
int responseCode = connection.getResponseCode();
|
|
|
if (responseCode == HttpURLConnection.HTTP_OK || responseCode == HttpURLConnection.HTTP_PARTIAL) {
|
|
|
+ long expectedSize = connection.getContentLengthLong();
|
|
|
try (InputStream inputStream = connection.getInputStream();
|
|
|
OutputStream outputStream = Files.newOutputStream(file.toPath())) {
|
|
|
byte[] buffer = new byte[1024 * 1024];
|
|
@@ -116,7 +117,7 @@ public class VideoDownloader {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- if (file.length() != 0) {
|
|
|
+ if (file.length() != expectedSize) {
|
|
|
return 0;
|
|
|
}
|
|
|
}
|