mirror of
https://github.com/vmware-tanzu/velero.git
synced 2026-01-05 04:55:22 +00:00
Signed-off-by: huangkai <huangkai76@huawei.com>
This commit is contained in:
@@ -553,6 +553,9 @@ func downloadToTempFile(backupName string, backupStore persistence.BackupStore,
|
||||
|
||||
n, err := io.Copy(file, readCloser)
|
||||
if err != nil {
|
||||
//Temporary file has been created if we go here. And some problems occurs such as network interruption and
|
||||
//so on. So we close and remove temporary file first to prevent residual file.
|
||||
closeAndRemoveFile(file, logger)
|
||||
return nil, errors.Wrap(err, "error copying Backup to temp file")
|
||||
}
|
||||
|
||||
@@ -564,6 +567,7 @@ func downloadToTempFile(backupName string, backupStore persistence.BackupStore,
|
||||
}).Debug("Copied Backup to file")
|
||||
|
||||
if _, err := file.Seek(0, 0); err != nil {
|
||||
closeAndRemoveFile(file, logger)
|
||||
return nil, errors.Wrap(err, "error resetting Backup file offset")
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user