From 248d56c922dad4659a116c0d59ce58b7401c4627 Mon Sep 17 00:00:00 2001 From: Alexander-Ger-Reich <50119493+Alexander-Ger-Reich@users.noreply.github.com> Date: Sat, 10 May 2025 21:14:11 +0200 Subject: [PATCH] Update ChunkFromFileChannelRequestEntity.java The -1 can cause the last byte to not end up in the request body (incomplete file), causing the server to time out because it expects the content length to be one byte larger. However, this one byte that isn't loaded and isn't sent is present in the file. I was able to successfully test this and it fixed the error for me. Signed-off-by: Alexander-Ger-Reich <50119493+Alexander-Ger-Reich@users.noreply.github.com> --- .../lib/common/network/ChunkFromFileChannelRequestEntity.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library/src/main/java/com/owncloud/android/lib/common/network/ChunkFromFileChannelRequestEntity.java b/library/src/main/java/com/owncloud/android/lib/common/network/ChunkFromFileChannelRequestEntity.java index c0d6842201..682cb9dcb7 100644 --- a/library/src/main/java/com/owncloud/android/lib/common/network/ChunkFromFileChannelRequestEntity.java +++ b/library/src/main/java/com/owncloud/android/lib/common/network/ChunkFromFileChannelRequestEntity.java @@ -103,7 +103,7 @@ public void writeRequest(final OutputStream out) throws IOException { if (size == 0) { size = -1; } - long maxCount = Math.min(mOffset + length - 1, mChannel.size()); + long maxCount = Math.min(mOffset + length, mChannel.size()); while (mChannel.position() < maxCount) { readCount = mChannel.read(mBuffer); try {