-
Notifications
You must be signed in to change notification settings - Fork 760
Description
Describe the bug
When using RustFS as an S3‑compatible backend, listing objects with a prefix that contains the same folder name twice in a row does not behave correctly.
If an object key contains folder1/folder2/..., everything works as expected, but if the path uses folder1/folder1/..., the nested prefix is not listed in either the RustFS UI or S3 clients such as s3cmd and mc.
This looks like a bug in how RustFS builds CommonPrefixes / handles prefixes for ListObjectsV2.
Environment
RustFS version: 1.0.0-alpha.72
Deployment: Docker Compose
S3 client: s3cmd, mc (and RustFS web UI)
Endpoint: https://rustfs....selfhosted.net (RustFS with TLS enabled)
To Reproduce
-
Create a bucket, for example:
s3cmd mb s3://test-bucket -
Upload two files with different nested prefixes:
# works fine
s3cmd put ./file1.txt s3://test-bucket/folder1/folder2/file1.txt
# problematic case
s3cmd put ./file2.txt s3://test-bucket/folder1/folder1/file2.txt
-
List the top‑level prefix:
s3cmd ls s3://test-bucket/folder1/ -
Observe what is shown:
s3cmd ls s3://test-bucket/folder1/- RustFS web UI when you navigate into test-bucket → folder1/
Expected behavior
Both nested prefixes should be visible when listing folder1/:
folder1/folder2/
folder1/folder1/
In s3cmd:
s3cmd ls s3://test-bucket/folder1/
should show something like:
DIR s3://test-bucket/folder1/folder1/
DIR s3://test-bucket/folder1/folder2/
Actual behavior
For the folder1/folder2/file1.txt case everything works correctly:
s3cmd ls s3://test-bucket/folder1/ (and the UI) shows that folder2/ exists under folder1/.
For the folder1/folder1/file2.txt case:
s3cmd ls s3://test-bucket/folder1/
does not show that folder1/folder1/ exists.
The RustFS UI also does not show the nested folder1 under folder1/.
Direct access to the full key still works (as well as put, get, etc):
s3cmd ls s3://test-bucket/folder1/folder1/
s3cmd ls s3://test-bucket/folder1/folder1/file2.txt
so the object is stored, but the intermediate prefix is not returned in the listing.
It looks like a bug in how RustFS groups/returns prefixes for ListObjectsV2 when a subfolder has the same name as its parent (e.g. folder1/folder1/...).
Screenshots
Desktop:
- OS: MacOS Tahoe 26.1
- Browser: Firefox
- Version: 145.0.2 (aarch64)
Additional context
- The issue is reproducible both in the RustFS UI and via S3 clients (s3cmd, and mc) using standard
Prefix=folder1/+Delimiter=/style listing. - Other prefixes like
folder1/folder2/...work fine, so the problem seems specific to repeated folder names in the path (X/X/...). - In python boto3 it works fine (without an issue):
% python3 s3_rustfs.py list
Objects in s3://test-bucket/
folder1/folder1/file2.txt 11 bytes 2025-12-10 14:17:47.285000+00:00
folder1/folder2/file1.txt 8 bytes 2025-12-10 14:17:43.002000+00:00
Where s3_rustfs.py - simple script to put, get, list, etc. files from S3 buckets using boto3 library.
- Also UI shows the file if put prefix manually in URL, e.g.
https://rustfs....selfhosted.net/rustfs/console/browser/test-bucket/folder1%2Ffolder1%2F