Missing VersionID for versioned buckets in API (#4796)
This commit is contained in:
parent
76605e30a0
commit
fc1ef55adc
@ -60,3 +60,4 @@ Moto is written by Steve Pulec with contributions from:
|
|||||||
* [Kyle Jones](https://github.com/Kerl1310)
|
* [Kyle Jones](https://github.com/Kerl1310)
|
||||||
* [Mickaël Schoentgen](https://github.com/BoboTiG)
|
* [Mickaël Schoentgen](https://github.com/BoboTiG)
|
||||||
* [Ariel Beck](https://github.com/arielb135)
|
* [Ariel Beck](https://github.com/arielb135)
|
||||||
|
* [Roman Rader](https://github.com/rrader/)
|
||||||
|
@ -1272,6 +1272,9 @@ class ResponseObject(_TemplateEnvironmentMixin, ActionAuthenticatorMixin):
|
|||||||
elif key is None:
|
elif key is None:
|
||||||
raise MissingVersion()
|
raise MissingVersion()
|
||||||
|
|
||||||
|
if key.version_id:
|
||||||
|
response_headers["x-amz-version-id"] = key.version_id
|
||||||
|
|
||||||
if key.storage_class == "GLACIER":
|
if key.storage_class == "GLACIER":
|
||||||
raise InvalidObjectState(storage_class="GLACIER")
|
raise InvalidObjectState(storage_class="GLACIER")
|
||||||
if if_unmodified_since:
|
if if_unmodified_since:
|
||||||
|
@ -3562,6 +3562,7 @@ def test_boto3_put_object_tagging_on_earliest_version():
|
|||||||
|
|
||||||
# Older version has tags while the most recent does not
|
# Older version has tags while the most recent does not
|
||||||
resp = s3.get_object_tagging(Bucket=bucket_name, Key=key, VersionId=first_object.id)
|
resp = s3.get_object_tagging(Bucket=bucket_name, Key=key, VersionId=first_object.id)
|
||||||
|
resp["VersionId"].should.equal(first_object.id)
|
||||||
resp["ResponseMetadata"]["HTTPStatusCode"].should.equal(200)
|
resp["ResponseMetadata"]["HTTPStatusCode"].should.equal(200)
|
||||||
sorted_tagset = sorted(resp["TagSet"], key=lambda t: t["Key"])
|
sorted_tagset = sorted(resp["TagSet"], key=lambda t: t["Key"])
|
||||||
sorted_tagset.should.equal(
|
sorted_tagset.should.equal(
|
||||||
@ -3571,6 +3572,7 @@ def test_boto3_put_object_tagging_on_earliest_version():
|
|||||||
resp = s3.get_object_tagging(
|
resp = s3.get_object_tagging(
|
||||||
Bucket=bucket_name, Key=key, VersionId=second_object.id
|
Bucket=bucket_name, Key=key, VersionId=second_object.id
|
||||||
)
|
)
|
||||||
|
resp["VersionId"].should.equal(second_object.id)
|
||||||
resp["ResponseMetadata"]["HTTPStatusCode"].should.equal(200)
|
resp["ResponseMetadata"]["HTTPStatusCode"].should.equal(200)
|
||||||
resp["TagSet"].should.equal([])
|
resp["TagSet"].should.equal([])
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user