Skip to content
This repository was archived by the owner on Dec 4, 2023. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions src/main/scala/io/findify/s3mock/response/ListBucket.scala
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,15 @@ case class ListBucket(bucket:String, prefix: Option[String], delimiter: Option[S
def toXML =
<ListBucketResult xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
<Name>{bucket}</Name>
{ prefix.map(p => <Prefix>{p}</Prefix> ) }
{ delimiter.map(d => <Delimiter>{d}</Delimiter>) }
{ if (commonPrefixes.nonEmpty) <CommonPrefixes> {commonPrefixes.map(cp => <Prefix>{cp}</Prefix>)} </CommonPrefixes> }
{ if (prefix.isDefined) <Prefix>{prefix.get}</Prefix> }
{ if (delimiter.isDefined) <Delimiter>{delimiter.get}</Delimiter> }
{ if (commonPrefixes.nonEmpty)
{commonPrefixes.map(cp =>
<CommonPrefixes>
<Prefix>{cp}</Prefix>
</CommonPrefixes>
)}
}
<KeyCount>{contents.length}</KeyCount>
<MaxKeys>1000</MaxKeys>
<IsTruncated>{isTruncated}</IsTruncated>
Expand Down
4 changes: 2 additions & 2 deletions src/test/scala/io/findify/s3mock/GetPutObjectTest.scala
Original file line number Diff line number Diff line change
Expand Up @@ -111,10 +111,10 @@ class GetPutObjectTest extends S3MockTest {

it should "work with = in path" in {
s3.createBucket("urlencoded")
s3.listBuckets().exists(_.getName == "urlencoded") shouldBe true
s3.listBuckets().asScala.exists(_.getName == "urlencoded") shouldBe true
s3.putObject("urlencoded", "path/with=123/foo", "bar=")
s3.putObject("urlencoded", "path/withoutequals/foo", "bar")
val result = s3.listObjects("urlencoded").getObjectSummaries.toList.map(_.getKey)
val result = s3.listObjects("urlencoded").getObjectSummaries.asScala.toList.map(_.getKey)
result shouldBe List("path/with=123/foo", "path/withoutequals/foo")
getContent(s3.getObject("urlencoded", "path/with=123/foo")) shouldBe "bar="
getContent(s3.getObject("urlencoded", "path/withoutequals/foo")) shouldBe "bar"
Expand Down