﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
28165	FileExtensionValidator's allowed_extensions must be given in lower case	Arne de Laat	nobody	"Using any uppercase character for an 'allowed_extension' prevents it from being matched. Because the input filename is being lowered before comparison to the extensions.

Here is an example:

{{{
#!python
from django.core.validators import FileExtensionValidator
from collections import namedtuple

valid = FileExtensionValidator(['pdf', 'png'])
File = namedtuple('File', ['name'])

# valid: different case in file name
named_file = File(name='myfile.PDF')
valid(named_file)
named_file = File(name='myfile.PdF')
valid(named_file)

# using uppercase in validator
valid = FileExtensionValidator(['PDF', 'PNG'])

# invalid: everything, because the case of the input is lowered
named_file = File(name='myfile.PDF')
valid(named_file)
# ValidationError: [""File extension 'pdf' is not allowed. Allowed extensions are: 'PDF, PNG'.""]

named_file = File(name='myfile.pdf')
valid(named_file)
# ValidationError: [""File extension 'pdf' is not allowed. Allowed extensions are: 'PDF, PNG'.""]
}}}"	Bug	closed	File uploads/storage	1.11	Normal	fixed	validators filefield		Accepted	1	0	0	0	0	0
