diff --git a/api/src/main/java/telegram/files/TelegramVerticle.java b/api/src/main/java/telegram/files/TelegramVerticle.java index 9ab8e09..831c920 100644 --- a/api/src/main/java/telegram/files/TelegramVerticle.java +++ b/api/src/main/java/telegram/files/TelegramVerticle.java @@ -421,16 +421,16 @@ public class TelegramVerticle extends AbstractVerticle { if (file.local == null) { return Future.failedFuture("File not started downloading"); } + if (file.local.isDownloadingCompleted) { + return DataVerticle.fileRepository.updateStatus( + file.id, + file.remote.uniqueId, + file.local.path, + FileRecord.DownloadStatus.completed, + System.currentTimeMillis() + ).compose(r -> Future.failedFuture("File is already downloaded successfully")); + } if (isPaused && !file.local.isDownloadingActive) { - if (file.local.isDownloadingCompleted) { - return DataVerticle.fileRepository.updateStatus( - file.id, - file.remote.uniqueId, - file.local.path, - FileRecord.DownloadStatus.completed, - System.currentTimeMillis() - ).compose(r -> Future.failedFuture("File is already downloaded successfully")); - } return Future.failedFuture("File is not downloading"); } if (!isPaused && file.local.isDownloadingActive) {