This looks like we will require two places to add this check:
1) _sftpDownloadFile
2) _downloadFile (at the end)
The tricky part will be to write a test that is called for every type of download that we support. I.e. when we add support to ftp download (SYNPY-53) we would need to add this check there as well.
All of these functions call _downloadFile:
_downloadFileEntity
getWiki (get wiki markdown)
_downloadWikiAttachment
_queryTableCsv
downloadTableFile
downloadTableColumns
It'd be nice to check MD5 in all cases, but we don't always have a file handle and thus the expected MD5. Getting the filehandle is an option, but is it worth the extra round-trip?
The most important case is downloading a file entity, so, my vote is we leave it at that.
This should address these issues: SYNPY-261, SYNPY-337,
Chris: I don't think that this addresses and as those are related to retrying on failures during download.
I have been using these changes for the last few days and it has caught some errors already.