diff options
-rw-r--r-- | internal/contentenc/offsets.go | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/internal/contentenc/offsets.go b/internal/contentenc/offsets.go index ebafe9b..813a15f 100644 --- a/internal/contentenc/offsets.go +++ b/internal/contentenc/offsets.go @@ -28,8 +28,7 @@ func (be *ContentEnc) BlockNoToPlainOff(blockNo uint64) uint64 { // PlainSize - calculate plaintext size from ciphertext size func (be *ContentEnc) CipherSizeToPlainSize(cipherSize uint64) uint64 { - - // Zero sized files stay zero-sized + // Zero-sized files stay zero-sized if cipherSize == 0 { return 0 } @@ -55,6 +54,10 @@ func (be *ContentEnc) CipherSizeToPlainSize(cipherSize uint64) uint64 { // CipherSize - calculate ciphertext size from plaintext size func (be *ContentEnc) PlainSizeToCipherSize(plainSize uint64) uint64 { + // Zero-sized files stay zero-sized + if plainSize == 0 { + return 0 + } // Block number at last byte blockNo := be.PlainOffToBlockNo(plainSize - 1) |