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

Glob uses rsplit #98

Open
LevitatingOrange opened this issue Jul 20, 2023 · 1 comment
Open

Glob uses rsplit #98

LevitatingOrange opened this issue Jul 20, 2023 · 1 comment

Comments

@LevitatingOrange
Copy link

Hello,

I have trouble getting Folder.glob to work for deeper nested glob patterns. The issue seems to stem from using rsplit inside
the _glob function of Folder:

split_pattern = pattern.rsplit('/', 1)

If we for example have the pattern root/inbox/todos, then glob won't return any folder entry even if the path exists. You use rsplit('/', 1) which will split on the first / it encounters from the right but then stop, e.g.

"root/inbox/todos".rsplit('/', 1) # will return ["root/inbox", "todos"]

Afterwards you match each child of the folder with the first part of the returned array, e.g.

fnmatch('root', 'root/inbox') # will return false

I think you meant to use split not rsplit. split splits starting from the left and would correctly only use root as the argument to fnmatch.

Did I miss something here? If my assumptions are correct I am happy to submit a small pull request to remedy this issue.

@ecederstrand
Copy link
Contributor

This is a fork of https://github.com/ecederstrand/exchangelib. This issue should be closed in favor of ecederstrand/exchangelib#1212

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

No branches or pull requests

2 participants