If a file that hadn't been read was shrunk with Truncate, the cache
file was cut to the new size but the kept part of the file still had
to be fetched on close. The downloader wrote the whole remote object
into the cache file, which grew it back to its old size, so the upload
replaced the object with the original contents.
Stop the downloader writing past the end of the item, and add tests at
the vfscache and vfs levels.
Fixes#10047