Skip to content
This repository has been archived by the owner on Dec 4, 2023. It is now read-only.

fix ListBucket xml response #181

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

elinger
Copy link

@elinger elinger commented Oct 29, 2021

I bumped into a strange behavior in Alpakka S3 when using S3.listBucketAndCommonPrefixes with s3mock. According to https://docs.aws.amazon.com/AmazonS3/latest/API/API_ListObjectsV2.html, CommonPrefix should be repeated for each common prefix, which is currently not the case in s3mock.

The following is copied from https://docs.aws.amazon.com/AmazonS3/latest/API/API_ListObjectsV2.html:

<ListBucketResult xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
  <Name>example-bucket</Name>
  <Prefix>photos/2006/</Prefix>
  <KeyCount>3</KeyCount>
  <MaxKeys>1000</MaxKeys>
  <Delimiter>/</Delimiter>
  <IsTruncated>false</IsTruncated>
  <Contents>
    <Key>photos/2006/</Key>
    <LastModified>2016-04-30T23:51:29.000Z</LastModified>
    <ETag>"d41d8cd98f00b204e9800998ecf8427e"</ETag>
    <Size>0</Size>
    <StorageClass>STANDARD</StorageClass>
  </Contents>

  <CommonPrefixes>
    <Prefix>photos/2006/February/</Prefix>
  </CommonPrefixes>
  <CommonPrefixes>
    <Prefix>photos/2006/January/</Prefix>
  </CommonPrefixes>
</ListBucketResult>

Notice multiple occurrences of CommonPrefix

Prefix and Delimiter weren't serialized to XML properly either. This is now fixed.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant