Commits

Anonymous committed 1b66c90

Fix up #9280.

Comments (0)

Files changed (1)

trac/attachment.py

                 listener.attachment_reparented(self, old_realm, old_id)
 
     def insert(self, filename, fileobj, size, t=None, db=None):
+        self.filename = None
         self.size = size and int(size) or 0
         if t is None:
             t = datetime.now(utc)
         if not filename:
             raise TracError(_('No file uploaded'))
         # Now the filename is known, update the attachment resource
-        # attachment.filename = filename
+        attachment.filename = filename
         attachment.description = req.args.get('description', '')
         attachment.author = get_reporter_id(req, 'author')
         attachment.ipnr = req.remote_addr
                 old_attachment.delete()
             except TracError:
                 pass # don't worry if there's nothing to replace
-            attachment.filename = None
         attachment.insert(filename, upload.file, size)
 
         req.redirect(get_resource_url(self.env, attachment.resource(id=None),