1
mirror of https://github.com/rclone/rclone synced 2024-11-24 01:26:25 +01:00

serve s3: fix error handling for listing non-existent prefix - fixes #7455

Before this change serve s3 would return NoSuchKey errors when a non
existent prefix was listed.

This change fixes it to return an empty list like AWS does.

This was discovered by the full integration tests.
This commit is contained in:
Nick Craig-Wood 2023-11-24 17:14:40 +00:00
parent e7c002adef
commit aaa897337d

View File

@ -84,7 +84,10 @@ func (b *s3Backend) ListBucket(bucket string, prefix *gofakes3.Prefix, page gofa
err = b.entryListR(bucket, path, remaining, prefix.HasDelimiter, response)
}
if err != nil {
if err == gofakes3.ErrNoSuchKey {
// AWS just returns an empty list
response = gofakes3.NewObjectList()
} else if err != nil {
return nil, err
}