Enforce ascii filenames for uploads

This commit is contained in:
Erik Johnston 2015-06-30 10:31:59 +01:00
parent 2124f668db
commit 9beaedd164
3 changed files with 15 additions and 1 deletions

View file

@ -33,3 +33,12 @@ def random_string_with_symbols(length):
return ''.join(
random.choice(_string_with_symbols) for _ in xrange(length)
)
def is_ascii(s):
try:
s.encode("ascii")
except UnicodeDecodeError:
return False
else:
return True