From 67a270ce4213e133d0b8c9eea793c855292a0dfb Mon Sep 17 00:00:00 2001 From: liamcottle Date: Wed, 18 Dec 2024 01:38:39 +1300 Subject: [PATCH] fix transfer progress --- src/js/Connection.js | 2 +- src/js/FileTransferrer.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/js/Connection.js b/src/js/Connection.js index 245d663..c486bed 100644 --- a/src/js/Connection.js +++ b/src/js/Connection.js @@ -644,7 +644,7 @@ class Connection { // update file transfer progress fileTransfer.status = FileTransferrer.STATUS_SENDING; - fileTransfer.progress = Math.min(100, Math.ceil(requestFileChunk.offset + requestFileChunk.length / fileTransfer.filesize * 100)); + fileTransfer.progress = Math.min(100, Math.ceil((requestFileChunk.offset + requestFileChunk.length) / fileTransfer.filesize * 100)); // send file part await FileTransferrer.sendFileChunk(fileTransfer, requestFileChunk.offset, requestFileChunk.length); diff --git a/src/js/FileTransferrer.js b/src/js/FileTransferrer.js index 6cc90f1..4157293 100644 --- a/src/js/FileTransferrer.js +++ b/src/js/FileTransferrer.js @@ -105,7 +105,7 @@ class FileTransferrer { } // update file transfer progress - fileTransfer.progress = Math.min(100, Math.ceil(fileChunk.offset + fileChunk.length / fileTransfer.filesize * 100)); + fileTransfer.progress = Math.min(100, Math.ceil((fileChunk.offset + fileChunk.length) / fileTransfer.filesize * 100)); } catch(e) { this.log("failed to get file chunk", e);