From d5742a9d93caa8fb2bceecb3f179a84fbe6c2f4a Mon Sep 17 00:00:00 2001 From: jarvis2f <137974272+jarvis2f@users.noreply.github.com> Date: Mon, 13 Jan 2025 11:22:51 +0800 Subject: [PATCH] =?UTF-8?q?=E2=9A=A1=EF=B8=8F=20fix:Fix=20file=20download?= =?UTF-8?q?=20status=20update=20logic=20to=20avoid=20unnecessary=20error?= =?UTF-8?q?=20messages.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/telegram/files/TelegramVerticle.java | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) 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) {