#9280 closed defect (fixed)
IAttachmentManipulators cannot validate the attachment's filename field
Reported by: | Owned by: | Emmanuel Blot | |
---|---|---|---|
Priority: | normal | Milestone: | 0.12.3 |
Component: | attachment | Version: | 0.12dev |
Severity: | normal | Keywords: | |
Cc: | Branch: | ||
Release Notes: | |||
API Changes: | |||
Internal Changes: |
Description
In attachment.py#AttachmentModule#_do_save setting attachment.filename is outcommented.
Therefore, ticket manipulators cannot validate the filename easily, unless they reimplement part of the _do_save method.
In this patch
-
attachment.py
255 255 256 256 if not os.access(self.path, os.F_OK): 257 257 os.makedirs(self.path) 258 # must reset self.filename prior insert 259 self.filename = None 258 260 filename = unicode_quote(filename) 259 261 path, targetfile = create_unique_file(os.path.join(self.path, 260 262 filename)) … … 631 633 if not filename: 632 634 raise TracError(_('No file uploaded')) 633 635 # Now the filename is known, update the attachment resource 634 # attachment.filename = filename 636 # must be set so that validators can validate the filename 637 attachment.filename = filename 635 638 attachment.description = req.args.get('description', '') 636 639 attachment.author = get_reporter_id(req, 'author') 637 640 attachment.ipnr = req.remote_addr
the filename will be set, and, since it causes problems with Attachment#insert when doing so prior to the attachment being inserted, in the insert method the filename will be reset to None.
Attachments (0)
Change History (5)
comment:1 by , 15 years ago
Milestone: | 0.12 → next-minor-0.12.x |
---|
comment:2 by , 14 years ago
Owner: | set to |
---|
follow-up: 4 comment:3 by , 14 years ago
Milestone: | next-minor-0.12.x → 0.12.3 |
---|---|
Resolution: | → fixed |
Status: | new → closed |
Fixed in [10695]
follow-up: 5 comment:4 by , 14 years ago
comment:5 by , 14 years ago
Replying to eblot:
editing
svn:log
is not allowed.
Well, yes, since we have git & mercurial mirrors, we disabled that in order to not have different commit logs between the systems.
Not a regression, not critical → not for 0.12.