Opened 13 years ago

Closed 12 years ago

#8066 closed defect (fixed)

TracLink to a PDF in the repository is not redirected

Reported by: boleslaw.tokarski@… Owned by: Ryan J Ollos
Priority: normal Component: PdfRedirectorPlugin
Severity: normal Keywords: source browser, preview
Cc: Steffen Hoffmann Trac Release: 0.12



I gave the plugin a try. It looks good when the file referenced is an attachment. However when you use [source:file.pdf] then the preview is still generated. I tried that on a git repository, but I suppose that svn behaves the same way. It would be cool to have that straight. Thanks for your good work!


Attachments (0)

Change History (9)

comment:1 Changed 13 years ago by Ryan J Ollos

Summary: PDF preview in repository browserTracLink to a PDF in the repository is not redirected

comment:2 Changed 12 years ago by zgoey@…

Yes, svn behaves in the same way. I agree that this would be a nice enhancement.

comment:3 Changed 12 years ago by Ryan J Ollos

Cc: Steffen Hoffmann added; anonymous removed
Owner: changed from Nicholas Bergson-Shilcock to Ryan J Ollos
Status: newassigned

comment:4 Changed 12 years ago by Ryan J Ollos

Proposed patch, which is nearly a complete rewrite of this tiny plugin.

  • trunk/pdfredirector/

    1313        return template, data, content_type
    1515    def pre_process_request(self, req, handler):
    1617        path = req.path_info.strip('/').split('/')
    17         if len(path) < 2 or path[0] != 'attachment' or req.args.get('action') == 'delete':
    18             return handler
    20         if not path[-1].lower().endswith('.pdf'):
    21             return handler
    23         filename = req.href(*(['raw-attachment'] + path[1:]))
    25         req.redirect(filename)
     19        if len(path) > 1 and path[-1].lower().endswith('.pdf'):
     20            if path[0] == 'attachment' and not req.args.get('action') == 'delete':
     21                filepath = req.href(*(['raw-attachment'] + path[1:]))
     22                req.redirect(filepath)
     23            elif path[0] == 'browser':
     24                path[0] = 'export'
     25                rev = req.args.get('rev', 'HEAD')
     26                path.insert(1, rev)
     27                filepath = req.href('/'.join(path))
     28                req.redirect(filepath)
     30        return handler

comment:5 Changed 12 years ago by Ryan J Ollos

(In [11799]) Refs #8066: Redirect TracLink to a PDF in the repository.

comment:6 Changed 12 years ago by Ryan J Ollos

Code review and feedback welcomed and appreciated.

comment:7 Changed 12 years ago by Ryan J Ollos

I think it is time to bump the revision and create a tag for this. Anyone r11799 or later that can give some feedback?

comment:8 Changed 12 years ago by Ryan J Ollos

(In [12181]) Refs #8066: Bumped version to 0.3. Added tags directory.

comment:9 Changed 12 years ago by Ryan J Ollos

Resolution: fixed
Status: assignedclosed

(In [12182]) Fixes #8066: Tagged version 0.3.

Modify Ticket

Change Properties
Set your email in Preferences
as closed The owner will remain Ryan J Ollos.
The resolution will be deleted. Next status will be 'reopened'.

Add Comment

E-mail address and name can be saved in the Preferences.

Note: See TracTickets for help on using tickets.