Skip to content

Buggy behavior in matching addresses #180

Open
@stachursky444

Description

@stachursky444

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))):

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions