mirror of
https://code.eliotberriot.com/funkwhale/funkwhale.git
synced 2025-10-03 19:39:18 +02:00
13 lines
361 B
Python
13 lines
361 B
Python
import unicodedata
|
|
|
|
from django.core.files.storage import FileSystemStorage
|
|
|
|
|
|
class ASCIIFileSystemStorage(FileSystemStorage):
|
|
"""
|
|
Convert unicode characters in name to ASCII characters.
|
|
"""
|
|
|
|
def get_valid_name(self, name):
|
|
name = unicodedata.normalize("NFKD", name).encode("ascii", "ignore")
|
|
return super().get_valid_name(name)
|