smogon / pokemon-showdown-client

The client for Pokémon Showdown
http://pokemonshowdown.com
GNU Affero General Public License v3.0
555 stars 779 forks source link

client: escape dots in URL regex #2243

Closed laggron42 closed 5 months ago

laggron42 commented 5 months ago

This line looks for URLs without a port specified and sets the default port of 8000. However, in the case of IP subdomains (such as 127.0.0.1-12345.psim.us), the port 12345 is overwritten because the - is ignored by the unescaped dot.

This PR escapes the dots forming the IP address and ensures the port is not being overwritten when specified.

Tested in the console's browser:

image
Zarel commented 5 months ago

Thanks!