#2983: ImageField not deleing previously attached file when updated
----------------------+-----------------------------------------------------
   Reporter:  Shimon  |                Owner:  nobody                
     Status:  new     |            Component:  Core framework        
    Version:  SVN     |           Resolution:                        
   Keywords:          |                Stage:  Design decision needed
  Has_patch:  1       |           Needs_docs:  0                     
Needs_tests:  0       |   Needs_better_patch:  0                     
----------------------+-----------------------------------------------------
Comment (by anonymous):

 Replying to [comment:7 [EMAIL PROTECTED]:
 > You are absolutely correctly, but it is also possible that a malicious
 user would upload a new file/image just so django would delete the
 existing one.
 
 What your referring to is a data access problem, i.e. a user has rights to
 change data they shouldn't.  On this level IMHO there is no conceptual
 difference between the image file and a text field in the database.
 
 The only difference is that instead of the data being stored inside the
 database (A Unicode byte string in the case of a database text field), the
 actual bits are stored externally to the database, and only a pointer to
 the data (the file's path) is stored in the database.
 
 From this viewpoint, not having django deleting the file when the database
 value is changed to point to another file is like not having a working
 garbage collector - users can fill up memory [Hard Disk] with old
 unreferenced values.
 
 > Think of this case.  There are already image files on the server (in use
 by another non-Django application).  I create a Django app that also makes
 use of these files.  So I import the files into the Django models (not
 making use of forms to upload them).  Then I decide to later change which
 image the Django app is using.  If Django was to delete the old file, It
 would break my non-Django application.
 
 Could it be that the feature you guys are after is to have ImageField
 who's attached images are not "managed by django" i.e. django should only
 store pointers to them but not delete them?
 
 > After all, it seems that is how the rest of the Django ORM works, Make
 the default behaviors reasonable, but have options to override the
 defaults for special circumstances.
 
 In other words, the default behavior should be: Django takes
 responsibility over all image files and collects it's own garbage in this
 respect (deletes image files no longer referenced from the db).
 
 Override the defaults: provide functionality for not touching the image
 files on disk and letting another piece of software manage them?
 
 Does this sound satisfactory?
 
 ubernordtrom: The ticket you assigned as duplicate is IMHO a different
 issue - it refers to the ability to delete an existing image file directly
 from the admin application.  This ticket is about deleting an old image
 file when a new image file is uploaded.

-- 
Ticket URL: <http://code.djangoproject.com/ticket/2983#comment:9>
Django Code <http://code.djangoproject.com/>
The web framework for perfectionists with deadlines
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to