Code

Opened 5 months ago

Last modified 5 days ago

#21548 assigned New feature

Add the ability to limit file extensions for ImageField and FileField

Reported by: timo Owned by: jfilipe
Component: Forms Version: master
Severity: Normal Keywords:
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

ImageField/FileField could have an optional extension whitelist. This could default to being empty for both fields to be totally backwards compatible, or could have sensible defaults for the ImageField based on the file types supported by PIL/low. The documentation should warn that you should not rely on file extensions to determine the actual content type of files.

There are probably some existing implementations we could borrow from, for example:

https://djangosnippets.org/snippets/977/

Attachments (0)

Change History (3)

comment:1 Changed 5 days ago by jfilipe

  • Owner changed from nobody to jfilipe
  • Status changed from new to assigned

comment:2 Changed 5 days ago by jfilipe

I have a work in progress PR here: https://github.com/jfilipe/django/pull/2

Wanted to get some feedback on the approach before I added some docs.

comment:3 Changed 5 days ago by jfilipe

  • Has patch set

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as assigned
The owner will be changed from jfilipe to anonymous. Next status will be 'assigned'
The ticket will be disowned. Next status will be 'new'
as The resolution will be set. Next status will be 'closed'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.