1
Vote

Download file missmatched

description

There is a little bug in procedure Download(...).
When a file exists and the size is greater than the size of the file to download, the result (the downloaded file) is missmatched.
The function OpenWrite() of FileInfo-Object opens the target file on position 0 and write the content of downloadstream beginning at this position.
But is the target file greater than written lenght, the file isn't truncated.
Example:
Target file to overwrite size =1000 Byte
Download size = 200 Byte
Result = 1000 Byte
 
Using the function Open(FileMode.Create, FileAccess.Write) instead Open() will truncate the file first.

comments