lib/scanner: Recheck file size and modification time after hashing (ref #3440)
To catch the case where the file changed. Also make sure we never let a size-vs-blocklist mismatch slip through. GitHub-Pull-Request: https://github.com/syncthing/syncthing/pull/3443
This commit is contained in:
@@ -941,7 +941,7 @@ func (f *rwFolder) handleFile(file protocol.FileInfo, copyChan chan<- copyBlocks
|
||||
|
||||
// Check for an old temporary file which might have some blocks we could
|
||||
// reuse.
|
||||
tempBlocks, err := scanner.HashFile(tempName, protocol.BlockSize, 0, nil)
|
||||
tempBlocks, err := scanner.HashFile(tempName, protocol.BlockSize, nil)
|
||||
if err == nil {
|
||||
// Check for any reusable blocks in the temp file
|
||||
tempCopyBlocks, _ := scanner.BlockDiff(tempBlocks, file.Blocks)
|
||||
|
||||
Reference in New Issue
Block a user