johannesboyne/gofakes3

ListObjects: IsTruncated omit when its value is false

mars4myshare opened this issue · 2 comments

Issue

When listObjects, if the number of objects is less than the 'MaxKeys', there is no 'IsTruncated' field

Detail

There were two objects in the bucket. Here is the return of listObjects

{
  Contents: [{
      ETag: "\"d084225e6144cafa320aa8454349094d\"",
      Key: "test1.txt",
      LastModified: 2019-12-26 08:11:40.466 +0000 UTC,
      Size: 56
    },{
      ETag: "\"d084225e6144cafa320aa8454349094d\"",
      Key: "test2.txt",
      LastModified: 2019-12-26 08:11:40.467 +0000 UTC,
      Size: 56
    }],
  Marker: "",
  MaxKeys: 3,
  Name: "newbucket",
  Prefix: ""
}

Expected return:

{
  Contents: [{
      ETag: "\"d084225e6144cafa320aa8454349094d\"",
      Key: "test1.txt",
      LastModified: 2019-12-26 08:44:01.079 +0000 UTC,
      Size: 56
    },{
      ETag: "\"d084225e6144cafa320aa8454349094d\"",
      Key: "test2.txt",
      LastModified: 2019-12-26 08:44:01.079 +0000 UTC,
      Size: 56
    }],
  IsTruncated: false,
  Marker: "",
  MaxKeys: 3,
  Name: "newbucket",
  Prefix: ""
}

Fixed with #39

Now the return is

{
  Contents: [{
      ETag: "\"d084225e6144cafa320aa8454349094d\"",
      Key: "test1.txt",
      LastModified: 2019-12-26 08:44:01.079 +0000 UTC,
      Size: 56
    },{
      ETag: "\"d084225e6144cafa320aa8454349094d\"",
      Key: "test2.txt",
      LastModified: 2019-12-26 08:44:01.079 +0000 UTC,
      Size: 56
    }],
  IsTruncated: false,
  Marker: "",
  MaxKeys: 3,
  Name: "newbucket",
  Prefix: ""
}

(s.a. fixed with #39 - merged)