Edgewall Software

Ticket #5718: downloadUnrenderableAttachments.2.2.patch

File downloadUnrenderableAttachments.2.2.patch, 1.3 KB (added by Ivan, 5 months ago)

d

  • \trac\attachment.py

    old new  
    399399            data = self._render_form(req, attachment) 
    400400        else: 
    401401            data = self._render_view(req, attachment) 
     402            if self.env.config.get('wiki','forward_to_raw_href') and data['preview']['rendered'] is None: 
     403                req.redirect(data['preview']['raw_href']) 
     404                return # cancel all template processing 
    402405 
    403406        add_stylesheet(req, 'common/css/code.css') 
    404407        return 'attachment.html', data, None 
  • \trac\templates\macros.html

    old new  
    172172      <a href="${url_of(attachment.resource)}" title="View attachment">$attachment.filename</a> 
    173173      (${sizeinfo(attachment.size)}) - added by <em>${authorinfo(attachment.author)}</em> 
    174174      ${dateinfo(attachment.date)} ago. 
     175      <py:if test="attachment and 'ATTACHMENT_DELETE' in perm(attachment.resource)"> 
     176          <a href="${url_of(attachment.resource)}?action=delete">${_('Delete')}</a> 
     177      </py:if> 
    175178    </py:def> 
    176179    <py:if test="alist.attachments or alist.can_create"> 
    177180      <py:choose test="">