aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--internal/contentenc/content.go4
1 files changed, 4 insertions, 0 deletions
diff --git a/internal/contentenc/content.go b/internal/contentenc/content.go
index 188b4e2..5d0ff49 100644
--- a/internal/contentenc/content.go
+++ b/internal/contentenc/content.go
@@ -277,6 +277,10 @@ func (be *ContentEnc) doEncryptBlock(plaintext []byte, blockNo uint64, fileID []
// MergeBlocks - Merge newData into oldData at offset
// New block may be bigger than both newData and oldData
func (be *ContentEnc) MergeBlocks(oldData []byte, newData []byte, offset int) []byte {
+ // Fastpath for small-file creation
+ if len(oldData) == 0 && offset == 0 {
+ return newData
+ }
// Make block of maximum size
out := make([]byte, be.plainBS)