Skip to content

Commit

Permalink
Merge pull request #13501 from dunn/deckname-ascii
Browse files Browse the repository at this point in the history
[deck_name#file_name] use anyascii to generate safe filenames
  • Loading branch information
silasary authored Jan 13, 2025
2 parents 27f04c6 + 2a51b7a commit 243ddbf
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion decksite/deck_name.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
from collections import OrderedDict

import titlecase
from anyascii import anyascii
from better_profanity import profanity

from magic import mana
Expand Down Expand Up @@ -114,7 +115,7 @@ def normalize(d: Deck) -> str:
def file_name(d: Deck) -> str:
safe_name = normalize(d).replace(' ', '-')
safe_name = re.sub('--+', '-', safe_name, flags=re.IGNORECASE)
safe_name = re.sub('[^0-9a-z-]', '', safe_name, flags=re.IGNORECASE)
safe_name = re.sub(':', '', anyascii(safe_name), flags=re.IGNORECASE)
return safe_name.strip('-')

def replace_space_alternatives(name: str) -> str:
Expand Down

0 comments on commit 243ddbf

Please sign in to comment.