Edgewall Software

Ticket #1929: attachment.py-link_with_params.patch

File attachment.py-link_with_params.patch, 1.1 KB (added by Shunichi Goto <gotoh@…>, 7 years ago)

A patch for attachment.py

  • attachment.py

     
    461461                    parent_type = path_info[1] 
    462462                if len(path_info) > 2: 
    463463                    parent_id = path_info[2] 
    464             filename = link 
     464            idx = link.find('?') 
     465            if idx < 0: 
     466                filename = link 
     467                params = '' 
     468            else: 
     469                filename = link[0:idx] 
     470                params = link[idx:] 
    465471        try: 
    466472            attachment = Attachment(self.env, parent_type, parent_id, filename) 
    467473            return '<a class="attachment" title="%s" href="%s">%s</a>' \ 
    468474                   % ('Attachment ' + attachment.title, 
    469                       attachment.href(), label) 
     475                      attachment.href() + params, label) 
    470476        except TracError: 
    471477            return '<a class="missing attachment" href="%s" rel="nofollow">%s</a>' \ 
    472478                   % (self.env.href.wiki(), label)