googlefonts / nanoemoji

A wee tool to build color fonts.
Apache License 2.0
239 stars 19 forks source link

Filename => codepoint conversion is over-lenient #465

Open rsheeter opened 8 months ago

rsheeter commented 8 months ago

Discovered courtesy of https://github.com/googlefonts/tofu/pull/1, if you ask nanoemoji to compile a file names tofu.svg it runs to completion. It should fail; this matches neither of our naming schemes. https://github.com/googlefonts/nanoemoji/blob/fb4b0b3e10f7197e7fe33c4ae6949841e4440397/src/nanoemoji/codepoints.py#L22-L26 is using search when it should be ensuring it matches the entire filename without extension (e.g. https://docs.python.org/3/library/pathlib.html#pathlib.PurePath.stem)