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

Buggy behavior in matching addresses #180

Open
stachursky444 opened this issue Oct 15, 2024 · 1 comment
Open

Buggy behavior in matching addresses #180

stachursky444 opened this issue Oct 15, 2024 · 1 comment

Comments

@stachursky444
Copy link

Hi
Using python-osc in my app I noticed a strange behavior related to the dispatcher. When I map a function to a path without using wildcards in the path, e.g. this way:
dispatcher.map('/qwer/asdf/zxcv', func)
the function is called obviously only when full path matches. But when I map a string this way:
dispatcher.map('/qwer/*/zxcv', func)
it matches not only all paths like: /qwer/whatever/zxcv, but also such ones like this: /qwer/whatever/zxcvsomethingmore.

I'm not sure whether it is correct mechanism and the problem is lack of my understanding of the OSC protocol or is it a bug. I noticed in the dispatcher's code, that in function handlers_for_addresses, in line 211, there is a variable addr used as a pattern, without added $ sign at the end, while in line 209 the pattern is ended with this sign (added in line 204).

or (('*' in addr) and re.match(addr.replace('*','[^/]*?/*'), address_pattern))):

@attwad
Copy link
Owner

attwad commented Dec 22, 2024

The OSC protocol doesn't mention if * has greedy matching or not, but regardless this looks like a bug, first step should be to reproduce that behavior in the test_dispatcher.py file then fixing it shouldn't be too hard. Contributions are welcome if you have time for it :)

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