@@ -60,6 +60,7 @@ type Info struct {
60
60
func GetInfo (r io.ReadSeeker , sysOS * sys.OS , outputPath string ) (* Info , error ) {
61
61
result := Info {}
62
62
hasIndexFile := false
63
+ hasOptimizedHeader := false
63
64
64
65
// Define some bools used to create points for OptimizedStorage field.
65
66
optimizedStorageFalse := false
@@ -102,16 +103,22 @@ func GetInfo(r io.ReadSeeker, sysOS *sys.OS, outputPath string) (*Info, error) {
102
103
}
103
104
104
105
if result .OptimizedStorage != nil {
105
- // No need to continue looking for optimized storage hint using the presence of the
106
- // container.bin file below, as the index.yaml file tells us directly.
107
- break
106
+ hasOptimizedHeader = true
108
107
} else {
109
108
// Default to non-optimized if not specified and continue reading to see if
110
109
// optimized container.bin file present.
111
110
result .OptimizedStorage = & optimizedStorageFalse
112
111
}
113
112
}
114
113
114
+ // Load old backup data.
115
+ if result .Config == nil && hdr .Name == "backup/container/backup.yaml" {
116
+ err = yaml .NewDecoder (tr ).Decode (& result .Config )
117
+ if err != nil {
118
+ return nil , err
119
+ }
120
+ }
121
+
115
122
// If the tarball contains a binary dump of the container, then this is an optimized backup.
116
123
// This check is only for legacy backups before we introduced the Type and OptimizedStorage fields
117
124
// in index.yaml, so there is no need to perform this type of check for other types of backups that
@@ -120,10 +127,12 @@ func GetInfo(r io.ReadSeeker, sysOS *sys.OS, outputPath string) (*Info, error) {
120
127
optimizedStorageTrue := true
121
128
result .OptimizedStorage = & optimizedStorageTrue
122
129
123
- // Stop read loop if index.yaml already parsed.
124
- if hasIndexFile {
125
- break
126
- }
130
+ hasOptimizedHeader = true
131
+ }
132
+
133
+ // Check if we're done processing what we need.
134
+ if hasIndexFile && hasOptimizedHeader && result .Config != nil {
135
+ break
127
136
}
128
137
}
129
138
0 commit comments