fix: b2 versionAt read metadata

This commit is contained in:
Davide Bizzarri
2025-05-13 18:35:57 +02:00
committed by Nick Craig-Wood
parent cd950e30cb
commit 6163ae7cc7
2 changed files with 23 additions and 8 deletions

View File

@@ -1673,6 +1673,21 @@ func (o *Object) getMetaData(ctx context.Context) (info *api.File, err error) {
return o.getMetaDataListing(ctx)
}
}
// If using versionAt we need to list the find the correct version.
if o.fs.opt.VersionAt.IsSet() {
info, err := o.getMetaDataListing(ctx)
if err != nil {
return nil, err
}
if info.Action == "hide" {
// Rerturn object not found error if the current version is deleted.
return nil, fs.ErrorObjectNotFound
}
return info, nil
}
_, info, err = o.getOrHead(ctx, "HEAD", nil)
return info, err
}