Skip to content

Commit c4bb283

Browse files
committed
Feed back encoding information to the FileUploadForm when doing mime type validation, for later use in decoding.
- Legacy-Id: 14777
1 parent 2b52919 commit c4bb283

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

ietf/meeting/forms.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -329,9 +329,11 @@ def clean_file(self):
329329
file = self.cleaned_data['file']
330330
validate_file_size(file)
331331
ext = validate_file_extension(file, self.extensions)
332-
mime_type = None
332+
mime_type, encoding = validate_mime_type(file, self.mime_types)
333+
if not hasattr(self, 'file_encoding'):
334+
self.file_encoding = {}
335+
self.file_encoding[file.name] = encoding.replace('charset=','') if encoding else None
333336
if self.mime_types:
334-
mime_type, encoding = validate_mime_type(file, self.mime_types)
335337
if mime_type != file.content_type:
336338
raise ValidationError('Upload Content-Type (%s) is different from the observed mime-type (%s)' % (file.content_type, mime_type))
337339
if mime_type in settings.MEETING_VALID_MIME_TYPE_EXTENSIONS:

0 commit comments

Comments
 (0)