Skip to content

S3FileSystem.isfile() returns True for a directory-like prefix (key/prefix collision), and the result changes after calling isdir() #999

Description

@csniu

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions