diff --git a/cmd/xl-storage-format-v2-legacy.go b/cmd/xl-storage-format-v2-legacy.go index 2aa99ebd5..093a8f1ce 100644 --- a/cmd/xl-storage-format-v2-legacy.go +++ b/cmd/xl-storage-format-v2-legacy.go @@ -83,6 +83,10 @@ func (j *xlMetaV2Version) unmarshalV(v uint8, bts []byte) (o []byte, err error) switch v { // We accept un-set as latest version. case 0, xlMetaVersion: + // Clear omitempty fields: + if j.ObjectV2 != nil && len(j.ObjectV2.PartIndices) > 0 { + j.ObjectV2.PartIndices = j.ObjectV2.PartIndices[:0] + } o, err = j.UnmarshalMsg(bts) // Clean up PartEtags on v1 diff --git a/cmd/xl-storage-format-v2.go b/cmd/xl-storage-format-v2.go index 9f99427f0..a76b48b77 100644 --- a/cmd/xl-storage-format-v2.go +++ b/cmd/xl-storage-format-v2.go @@ -575,7 +575,7 @@ func (j xlMetaV2Object) ToFileInfo(volume, path string) (FileInfo, error) { fi.Parts[i].ETag = j.PartETags[i] } fi.Parts[i].ActualSize = j.PartActualSizes[i] - if len(j.PartIndices) > 0 { + if len(j.PartIndices) == len(fi.Parts) { fi.Parts[i].Index = j.PartIndices[i] } }