FIX: dav_submission: filter non ascii-chars in directory and file names.

This commit is contained in:
2019-11-08 12:23:57 +01:00
parent 96ad5b30d4
commit 4ef91076e0

View File

@@ -153,10 +153,17 @@ class UploadView(generic.edit.FormView):
def _sanitize_filename(self, input):
max_length = None
discard_chars = u''
replace_chars = {
u'ä': u'ae',
u'ö': u'oe',
u'ü': u'ue',
u'ß': u'ss',
u'Ä': u'Ae',
u'Ö': u'Oe',
u'Ü': u'Ue',
}
allowed_chars = (u'abcdefghijklmnopqrstuvwxyz'
u'äöüß'
u'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
u'ÄÖÜ'
u'0123456789'
u'._-')
non_allowed_substitute = u'_'
@@ -169,6 +176,8 @@ class UploadView(generic.edit.FormView):
for c in input:
if c in discard_chars:
continue
elif c in replace_chars:
r += replace_chars[c]
elif allowed_chars is not None and c in allowed_chars:
r += c
elif allowed_chars is None and c.isalnum():