Edgewall Software
Modify

Opened 17 years ago

Closed 16 years ago

#6239 closed defect (fixed)

can't delete attachment if no HTML preview is available

Reported by: jhmark@… Owned by: Christian Boos
Priority: normal Milestone: 0.11
Component: attachment Version: 0.10.4
Severity: normal Keywords:
Cc: Branch:
Release Notes:
API Changes:
Internal Changes:

Description

Be a user with WIKI_DELETE privilege. Attach an MS Word document to a Trac page (e.g. foo.doc). Click on the link to the attachment. This goes to a page saying "HTML preview not available". Notice there is no "Delete Attachment" button, and no way to delete the attachment (as far as I can tell).

If a text file is attached, the user can delete it, as expected.

Attachments (0)

Change History (7)

comment:1 by sid, 17 years ago

Keywords: needinfo added

Potentially a duplicate of #3271. What browser (and version) are you using?

comment:2 by jhmark@…, 17 years ago

I think you are right. The problem goes away if I close all browser sessions and then reopen. (Firefox 2.0.0.8 on Winxp.)

I have confirmed that after the Trac permissions are changed, Firefox still caches an old version of the page, even after pushing Refresh.

comment:3 by sid, 16 years ago

Strangely, #3271 says that it only happens with text files, not binary ones such as the problem you reported. This does appear to be a caching problem though.

comment:4 by osimons, 16 years ago

Is it a problem or not? Close?

comment:5 by anonymous, 16 years ago

OK by me to close.

If the permissions are changed using trac-admin (so the user gains WIKI_DELETE privilege), a Firefox user may see out of date pages (without the Delete Attachment button) until the Firefox cache is cleared. This seems not ideal, but acceptable.

comment:6 by Christian Boos, 16 years ago

Component: wikiattachment
Keywords: needinfo removed
Milestone: 0.11.1
Status: newassigned

Simple fix:

  • trac/attachment.py

     
    617617
    618618    def _render_view(self, req, attachment):
    619619        req.perm(attachment.resource).require('ATTACHMENT_VIEW')
    620         req.check_modified(attachment.date)
     620        can_delete = 'ATTACHMENT_DELETE' in req.perm(attachment.resource)
     621        req.check_modified(attachment.date, str(can_delete))
    621622
    622623        data = {'mode': 'view',
    623624                'title': get_resource_name(self.env, attachment.resource),

comment:7 by Christian Boos, 16 years ago

Milestone: 0.11.10.11
Resolution: fixed
Status: assignedclosed

Patch committed as r6656.

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Christian Boos.
The resolution will be deleted. Next status will be 'reopened'.
to The owner will be changed from Christian Boos to the specified user.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.