Fix: ListObjectsV2 behaving differently than AWS API (#3545)
* fix : localstack issue https://github.com/issues?q=is%3Aopen+is%3Aissue+label%3A%22good+first+issue%22+language%3Ago * add assertion for error message as well
This commit is contained in:
parent
e6be3265ca
commit
dffc0e449c
3 changed files with 43 additions and 1 deletions
|
|
@ -424,3 +424,15 @@ class InvalidRange(S3ClientError):
|
|||
actual_size=actual_size,
|
||||
**kwargs
|
||||
)
|
||||
|
||||
|
||||
class InvalidContinuationToken(S3ClientError):
|
||||
code = 400
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
super(InvalidContinuationToken, self).__init__(
|
||||
"InvalidArgument",
|
||||
"The continuation token provided is incorrect",
|
||||
*args,
|
||||
**kwargs
|
||||
)
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@ from moto.s3bucket_path.utils import (
|
|||
from .exceptions import (
|
||||
BucketAlreadyExists,
|
||||
DuplicateTagKeys,
|
||||
InvalidContinuationToken,
|
||||
S3ClientError,
|
||||
MissingBucket,
|
||||
MissingKey,
|
||||
|
|
@ -529,6 +530,10 @@ class ResponseObject(_TemplateEnvironmentMixin, ActionAuthenticatorMixin):
|
|||
template = self.response_template(S3_BUCKET_GET_RESPONSE_V2)
|
||||
bucket = self.backend.get_bucket(bucket_name)
|
||||
|
||||
continuation_token = querystring.get("continuation-token", [None])[0]
|
||||
if continuation_token is not None and continuation_token == "":
|
||||
raise InvalidContinuationToken()
|
||||
|
||||
prefix = querystring.get("prefix", [None])[0]
|
||||
if prefix and isinstance(prefix, six.binary_type):
|
||||
prefix = prefix.decode("utf-8")
|
||||
|
|
@ -539,7 +544,6 @@ class ResponseObject(_TemplateEnvironmentMixin, ActionAuthenticatorMixin):
|
|||
|
||||
fetch_owner = querystring.get("fetch-owner", [False])[0]
|
||||
max_keys = int(querystring.get("max-keys", [1000])[0])
|
||||
continuation_token = querystring.get("continuation-token", [None])[0]
|
||||
start_after = querystring.get("start-after", [None])[0]
|
||||
|
||||
# sort the combination of folders and keys into lexicographical order
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue