mirror of
https://github.com/gilbertchen/duplicacy
synced 2025-12-06 00:03:38 +00:00
Fixed a bug in splitting the existing file that caused all chunks to be redownloaded
This commit is contained in:
@@ -1212,13 +1212,15 @@ func (manager *BackupManager) RestoreFile(chunkDownloader *ChunkDownloader, chun
|
|||||||
// truncated portion of the existing file
|
// truncated portion of the existing file
|
||||||
for i := entry.StartChunk; i <= entry.EndChunk+1; i++ {
|
for i := entry.StartChunk; i <= entry.EndChunk+1; i++ {
|
||||||
hasher := manager.config.NewKeyedHasher(manager.config.HashKey)
|
hasher := manager.config.NewKeyedHasher(manager.config.HashKey)
|
||||||
chunkSize := 1 // the size of extra chunk beyond EndChunk
|
chunkSize := 0
|
||||||
if i == entry.StartChunk {
|
if i == entry.StartChunk {
|
||||||
chunkSize -= entry.StartOffset
|
chunkSize = chunkDownloader.taskList[i].chunkLength - entry.StartOffset
|
||||||
} else if i == entry.EndChunk {
|
} else if i == entry.EndChunk {
|
||||||
chunkSize = entry.EndOffset
|
chunkSize = entry.EndOffset
|
||||||
} else if i > entry.StartChunk && i < entry.EndChunk {
|
} else if i > entry.StartChunk && i < entry.EndChunk {
|
||||||
chunkSize = chunkDownloader.taskList[i].chunkLength
|
chunkSize = chunkDownloader.taskList[i].chunkLength
|
||||||
|
} else {
|
||||||
|
chunkSize = 1 // the size of extra chunk beyond EndChunk
|
||||||
}
|
}
|
||||||
count := 0
|
count := 0
|
||||||
for count < chunkSize {
|
for count < chunkSize {
|
||||||
|
|||||||
Reference in New Issue
Block a user