Skip to content
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

local: only walk the subdirectory designated by prefix #212

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

Conversation

urisimchoni
Copy link
Contributor

This fixes issue #140.
When listing items using the local-file-system driver, only
traverse the subdirectory with longest prefix that contains
the given listing prefix.

Three cases are of interest:

a. The listing prefix is foo/bar/ - we walk subdirectory foo/bar
under the container's path.
b. The listing prefix is foo/ba - we walk subdirectory foo under
the container's path, and filter stuff that doesn't begin with
foo/ba.
c. The prefix is an empty string - walk the container's path like
today.

There's a rather aged PR for this issue - #149. However that PR has some issues - it uses path instead of filepath when filepath is required, and it doesn't take into account case c above. Because it's rather old, I opted to proposing another fix instead of commenting on the exising PR.

When listing items using the local-file-system driver, only
traverse the subdirectory with longest prefix that contains
the given listing prefix.

Three cases are of interest:

a. The listing prefix is foo/bar/ - we walk subdirectory foo/bar
   under the container's path.
b. The listing prefix is foo/ba - we walk subdirectory foo under
   the container's path, and filter stuff that doesn't begin with
   foo/ba.
c. The prefix is an empty string - walk the container's path like
   today.
@urisimchoni
Copy link
Contributor Author

rebased on master

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.

1 participant