S3FileSystem.isfile() returns True for a directory-like prefix (key/prefix collision), and the result changes after calling isdir()
Open
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 1k
- Forks
- 305
- Avg merge
- 22h 37m
- Merged PRs (30d)
- 4
Description
I have these two objects:
- s3://my-bucket/some/prefix (an object key exactly equal to the “directory” name)
- s3://my-bucket/some/prefix/file.txt (an object under that prefix)
Then:
from s3fs import S3FileSystem
fs = S3FileSystem()
print(fs.isfile('det-study-a/some/prefix/')) # True
print(fs.isdir('det-study-a/some/prefix/')) # True
print(fs.isfile('det-study-a/some/prefix/')) # False
print(fs.isdir('det-study-a/some/prefix/')) # True
Environment
- s3fs version: 2025.12.0
- Python: 3.12
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the key/prefix collision with the Python snippet, then inspect the S3FileSystem.isfile() and isdir() entry points. The fix is done when repeated isfile() and isdir() calls return consistent classifications for the same S3 path, including the exact-key and child-object case.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- aws, python
- Domain
- cloud
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100