Potential URL parsing bug

Hello, I stumbled upon a potential problem with the URL parsing in the chat:

It seems that the parsing of board positions has higher precedence than that of the URLs.
An URL with encoded arguments that match board positions won’t render correctly: eg.:

https://something.com?some%20string%C3%B3

I don’t know if it worth fixing. I just thought it might be of interest to someone.

3 Likes

Here’s the ordered regexes, general url indeed last.

2 Likes

rofl @ line 33

2 Likes

I don’t see move parsing in this one though. Is it passed as the extra replacements argument?

The move number on the end of the game number? Here’s the diff which added that.

Not that. The one that parses C3 and then places it as an object that you can hover over to see the coordinate on the board. Like so (url form OP)

image

These regex are for urls only as well as @ and # it seems.

I believe additional replacements are specified for game chat:

Yep that seems to be it. Seems like as I guessed it’s in the “extra replacements” and it’s just appended at the end, meaning it’s applied at the end too. I think links need to have priority over that but this design is bullet proof.