Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Filename => codepoint conversion is over-lenient #465

Open
rsheeter opened this issue Dec 21, 2023 · 0 comments
Open

Filename => codepoint conversion is over-lenient #465

rsheeter opened this issue Dec 21, 2023 · 0 comments

Comments

@rsheeter
Copy link
Collaborator

Discovered courtesy of googlefonts/tofu#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.

def from_filename(filename):
match = regex.search(r"(?:^emoji_u)?(?:[-_]?([0-9a-fA-F]{1,}))+", filename)
if not match:
raise ValueError(f"Bad filename {filename}; unable to extract codepoints")
return tuple(int(s, 16) for s in match.captures(1))
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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant