fix: version id no metadata key check

This commit is contained in:
Ben McClelland
2024-09-20 08:56:03 -07:00
parent 800cf62209
commit 20d65ea6d9
+6 -6
View File
@@ -2446,13 +2446,13 @@ func (p *Posix) GetObject(_ context.Context, input *s3.GetObjectInput) (*s3.GetO
if errors.Is(err, fs.ErrNotExist) {
return nil, s3err.GetAPIError(s3err.ErrNoSuchKey)
}
if err != nil && !errors.Is(err, meta.ErrNoSuchKey) {
return nil, fmt.Errorf("get obj versionId: %w", err)
}
if errors.Is(err, meta.ErrNoSuchKey) {
bucket = filepath.Join(p.versioningDir, bucket)
object = filepath.Join(genObjVersionKey(object), *input.VersionId)
}
if err != nil {
return nil, fmt.Errorf("get obj versionId: %w", err)
}
if string(vId) != *input.VersionId {
bucket = filepath.Join(p.versioningDir, bucket)
@@ -2678,13 +2678,13 @@ func (p *Posix) HeadObject(ctx context.Context, input *s3.HeadObjectInput) (*s3.
if errors.Is(err, fs.ErrNotExist) {
return nil, s3err.GetAPIError(s3err.ErrNoSuchKey)
}
if err != nil && !errors.Is(err, meta.ErrNoSuchKey) {
return nil, fmt.Errorf("get obj versionId: %w", err)
}
if errors.Is(err, meta.ErrNoSuchKey) {
bucket = filepath.Join(p.versioningDir, bucket)
object = filepath.Join(genObjVersionKey(object), *input.VersionId)
}
if err != nil {
return nil, fmt.Errorf("get obj versionId: %w", err)
}
if string(vId) != *input.VersionId {
bucket = filepath.Join(p.versioningDir, bucket)