milton2 icon indicating copy to clipboard operation
milton2 copied to clipboard

Milton CE GetableResource#sendContent() adds unwanted zero-bytes

Open stephanrauh opened this issue 4 years ago • 1 comments

We've written a Webdav server using the community edition of milton2. That works great - but when we download a file, sometimes unexpected zero bytes are added.

Maybe this is caused by our encryption. We don't store the original file on the server. Instead, we encrypt it when we upload the file, and we decrypt it during the download.

Of course, encrypting the file makes it larger.

After downloading the file, we observe that the file is decrypted correctly. However, it's too large. It has the size of the encrypted file. It's filled up with zero-bytes.

It seems milton2 always makes sure that the file size is the number returned by GetableResource#getContentLength(). In our case, the number return getContentLength() is larger than the real file size. It seems milton2 sets the file size to getContentLength(). In our case, this amounts to adding the content of the empty buffer.

stephanrauh avatar Dec 14 '20 17:12 stephanrauh

@frankyhoffmann Here's the ticket we've been talking about.

stephanrauh avatar Dec 14 '20 17:12 stephanrauh