From 60d1d1bb18e43e571ea218e32c302808427cf0bf Mon Sep 17 00:00:00 2001 From: Toad-Dev <748280+toad-dev@users.noreply.github.com> Date: Sun, 23 Jan 2022 22:20:14 -0800 Subject: [PATCH] Fix large file uploads producing oversized packets. - Fixes #1026 - The remaining bytes counter wasn't being decremented, so the code that splits off smaller packets was unreachable. Thus all file slices were being put into a single UploadFileMessage packet. --- .../computercraft/shared/network/server/UploadFileMessage.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/java/dan200/computercraft/shared/network/server/UploadFileMessage.java b/src/main/java/dan200/computercraft/shared/network/server/UploadFileMessage.java index 64f854a80..38c924789 100644 --- a/src/main/java/dan200/computercraft/shared/network/server/UploadFileMessage.java +++ b/src/main/java/dan200/computercraft/shared/network/server/UploadFileMessage.java @@ -160,6 +160,7 @@ public class UploadFileMessage extends ComputerServerMessage contents.position( currentOffset ).limit( currentOffset + canWrite ); slices.add( new FileSlice( fileId, currentOffset, contents.slice() ) ); currentOffset += canWrite; + remaining -= canWrite; } contents.position( 0 ).limit( capacity );