diff --git a/pkg/utils/FileReceiver.go b/pkg/utils/FileReceiver.go index a966c03..a71da1a 100644 --- a/pkg/utils/FileReceiver.go +++ b/pkg/utils/FileReceiver.go @@ -15,7 +15,12 @@ func ReceiveFile(path string, fileSize int, reader *bufio.Reader) bool { defer file.Close() // Params - buffer := make([]byte, 1024) + var buffer []byte + if fileSize < 1024 { + buffer = make([]byte, fileSize) + } else { + buffer = make([]byte, 1024) + } currentSize := 0 // Copy file