cmd serve s3: fix ListObjectsV2 response

add trailing slash to s3 ListObjectsV2 response because some clients expect a trailing forward slash to distinguish if the returned object is a directory

Fixes #8464
This commit is contained in:
fhuber 2025-05-07 15:35:41 +02:00 committed by Nick Craig-Wood
parent b8fde4fc46
commit a3f3fc61ee

View File

@ -28,7 +28,8 @@ func (b *s3Backend) entryListR(_vfs *vfs.VFS, bucket, fdPath, name string, addPr
if entry.IsDir() { if entry.IsDir() {
if addPrefix { if addPrefix {
response.AddPrefix(objectPath) prefixWithTrailingSlash := objectPath + "/"
response.AddPrefix(prefixWithTrailingSlash)
continue continue
} }
err := b.entryListR(_vfs, bucket, path.Join(fdPath, object), "", false, response) err := b.entryListR(_vfs, bucket, path.Join(fdPath, object), "", false, response)