Instead of replacing accented characters with an underscore when sanitizing file names in restricted mode, replace them with their non-accented equivalents fixes #9347
This commit is contained in:
parent
686cc89634
commit
79a2e94e79
2 changed files with 14 additions and 4 deletions
|
@ -14,8 +14,8 @@ import email.utils
|
|||
import errno
|
||||
import functools
|
||||
import gzip
|
||||
import itertools
|
||||
import io
|
||||
import itertools
|
||||
import json
|
||||
import locale
|
||||
import math
|
||||
|
@ -24,8 +24,8 @@ import os
|
|||
import pipes
|
||||
import platform
|
||||
import re
|
||||
import ssl
|
||||
import socket
|
||||
import ssl
|
||||
import struct
|
||||
import subprocess
|
||||
import sys
|
||||
|
@ -365,6 +365,11 @@ def sanitize_filename(s, restricted=False, is_id=False):
|
|||
Set is_id if this is not an arbitrary string, but an ID that should be kept if possible
|
||||
"""
|
||||
def replace_insane(char):
|
||||
accents = dict(zip('ÂÃÄÀÁÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõöøùúûüýþÿ',
|
||||
itertools.chain('AAAAAA', ['AE'], 'CEEEEIIIIDNOOOOOOUUUUYP', ['ss'],
|
||||
'aaaaaa', ['ae'], 'ceeeeiiiionoooooouuuuypy')))
|
||||
if restricted and char in accents:
|
||||
return accents[char]
|
||||
if char == '?' or ord(char) < 32 or ord(char) == 127:
|
||||
return ''
|
||||
elif char == '"':
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue