sftp didn't truncate it first, which would corrupt the file if the new file was shorter than the old.