@ -244,14 +244,25 @@ func (z *xlMetaV2) AddVersion(fi FileInfo) error {
}
}
}
}
dd , err := uuid . Parse ( fi . DataDir )
var dd uuid . UUID
if fi . DataDir != "" {
dd , err = uuid . Parse ( fi . DataDir )
if err != nil {
if err != nil {
return err
return err
}
}
}
ventry := xlMetaV2Version { }
ventry := xlMetaV2Version {
if fi . Deleted {
Type : ObjectType ,
ventry . Type = DeleteType
ObjectV2 : & xlMetaV2Object {
ventry . DeleteMarker = & xlMetaV2DeleteMarker {
VersionID : uv ,
ModTime : fi . ModTime . UnixNano ( ) ,
}
} else {
ventry . Type = ObjectType
ventry . ObjectV2 = & xlMetaV2Object {
VersionID : uv ,
VersionID : uv ,
DataDir : dd ,
DataDir : dd ,
Size : fi . Size ,
Size : fi . Size ,
@ -269,7 +280,6 @@ func (z *xlMetaV2) AddVersion(fi FileInfo) error {
PartActualSizes : make ( [ ] int64 , len ( fi . Parts ) ) ,
PartActualSizes : make ( [ ] int64 , len ( fi . Parts ) ) ,
MetaSys : make ( map [ string ] [ ] byte ) ,
MetaSys : make ( map [ string ] [ ] byte ) ,
MetaUser : make ( map [ string ] string , len ( fi . Metadata ) ) ,
MetaUser : make ( map [ string ] string , len ( fi . Metadata ) ) ,
} ,
}
}
for i := range fi . Erasure . Distribution {
for i := range fi . Erasure . Distribution {
@ -292,6 +302,7 @@ func (z *xlMetaV2) AddVersion(fi FileInfo) error {
ventry . ObjectV2 . MetaUser [ k ] = v
ventry . ObjectV2 . MetaUser [ k ] = v
}
}
}
}
}
if ! ventry . Valid ( ) {
if ! ventry . Valid ( ) {
return errors . New ( "internal error: invalid version entry generated" )
return errors . New ( "internal error: invalid version entry generated" )