smogon / pokemon-showdown

Pokémon battle simulator.
https://pokemonshowdown.com
MIT License
4.77k stars 2.79k forks source link

uhtml img tag requires double quotes now #8428

Closed Hippopotas closed 3 years ago

Hippopotas commented 3 years ago

It looks like with #8425 , img src now breaks on single quotes. Is this intended behavior?

These work:

/adduhtml test, <center><img src="https://i.imgur.com/c9nyFqJ.png" width=330 height=250 ></center>
/adduhtml test, <center><img src=https://i.imgur.com/c9nyFqJ.png width=330 height=250 ></center>

This does not work:

/adduhtml test, <center><img src='https://i.imgur.com/c9nyFqJ.png' width=330 height=250 ></center>

and returns error Image URLs must begin with 'https://' or 'data:'; 'http://' cannot be used.

mia-pi-git commented 3 years ago

Found the bug. The regex we use to check src attribs only checked for tags using "", so tags using '' had the '' included as part of the URI we validated. Hence, it would see a link start with 'https://, which it doesn't have a case for. I fixed that in https://github.com/smogon/pokemon-showdown/commit/e9f906e5f0b530e44dd7f5fe98bcd907268efb3e