The s3boto backend sets
content.name = cleaned_name. This causes a problem when
content is a
FieldFile which gets used after the save. The following illustrates the problem:
class MyModel(models.Model): file = models.FileField(upload_to="/foo") def my_method(): my_object = MyModel.objects.get(pk=1) #Let's say that my_object.file.name = "/foo/bar.zip" default_storage.save("/foo/bar2.zip", my_object.file) #Now my_object.file.name = "/foo/bar2.zip" my_object.file.delete() #Oops! Just deleted /foo/bar2.zip, not /foo/bar.zip
As far as I can see, setting
content.name isn't necessary. Could this line simply be removed?