Skip to content

fix s3 list_recursive to exclude sibling directories with shared prefixes #2441

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

mt-ob
Copy link
Collaborator

@mt-ob mt-ob commented Jun 3, 2025

No description provided.

@mt-ob mt-ob changed the title fix s3 list_recursive to exclude sibling directories with shared pref… fix s3 list_recursive to exclude sibling directories with shared prefixes Jun 3, 2025
@dotKokott
Copy link

This fix works for me @madhur-ob, thanks!

Looking forward to upgrade once that is merged :)

if not normalized_prefix.endswith("/"):
normalized_prefix += "/"
# Only include keys that are actually under our directory
if not (
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This filters out an object with key exactly equal to ABC/ when listing prefix ABC/. In S3 key names can actually contain / so someone could create a file called ABC/ (it's weird but valid)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so is the recommended change just > to >= ?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think that would work

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants