Исправление некоторых багов

This commit is contained in:
2025-12-28 21:15:18 +03:00
parent fe7a02cc18
commit 752d011565
3 changed files with 24 additions and 22 deletions

View File

@@ -395,6 +395,12 @@ func (data *SnapshotManagerData) ExtractSnapshot(ctx context.Context, snapshotID
// If cleanTarget is true, clean the target directory before extraction
if cleanTarget {
rc, err := zip.OpenReader(blobPath)
if err != nil {
return fmt.Errorf("snapshot archive is corrupted or unreadable, restore aborted to protect data: %w", err)
}
rc.Close()
// Remove the directory and recreate it
if err := os.RemoveAll(path); err != nil {
return fmt.Errorf("failed to clean target directory: %w", err)