go-osc
go-osc copied to clipboard
AddMsgHandler matches parts of addresses
Example code:
addr := "127.0.0.1:9000"
d := osc.NewStandardDispatcher()
d.AddMsgHandler("/time/str", func (msg *osc.Message) {
fmt.Print("-> ")
fmt.Println(msg)
})
Example console output:
-> /time ,f 16743.264
-> /time/str ,s 4:39:03.263
-> /time ,f 16743.36
-> /time/str ,s 4:39:03.359
The code should only match /time/str
but the MsgHandler matches /time
without str too.
This code lines seems to be the reason:
https://github.com/hypebeast/go-osc/blob/master/osc/osc.go#L146
https://github.com/hypebeast/go-osc/blob/master/osc/osc.go#L212
Escaping the address with \/
does not help.
If I do this, I will get an error unknown escape sequence
Current workaround:
- Implement a catch all MsgHandler ("*")
- Do the address check manually without Regex
I would be very happy to have this issue fixed because this creates very confusing issues.
Thanks a lot. Christian