mirror of
https://code.eliotberriot.com/funkwhale/funkwhale.git
synced 2025-10-04 05:49:16 +02:00
Fix #138: Better handling of utf-8 filenames during file import
This commit is contained in:
parent
ae65190364
commit
f1cf250e29
5 changed files with 38 additions and 0 deletions
12
api/funkwhale_api/common/storage.py
Normal file
12
api/funkwhale_api/common/storage.py
Normal file
|
@ -0,0 +1,12 @@
|
|||
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)
|
Loading…
Add table
Add a link
Reference in a new issue