Opened 6 years ago

Closed 4 years ago

#8066 closed defect (fixed)

TracLink to a PDF in the repository is not redirected

Reported by: boleslaw.tokarski@… Owned by: rjollos
Priority: normal Component: PdfRedirectorPlugin
Severity: normal Keywords: source browser, preview
Cc: hasienda 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 6 years ago by rjollos

  • Summary changed from PDF preview in repository browser to TracLink to a PDF in the repository is not redirected

comment:2 Changed 5 years ago by zgoey@…

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

comment:3 Changed 4 years ago by rjollos

  • Cc hasienda added; anonymous removed
  • Owner changed from nicholasbs to rjollos
  • Status changed from new to assigned

comment:4 Changed 4 years ago by rjollos

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 4 years ago by rjollos

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

comment:6 Changed 4 years ago by rjollos

Code review and feedback welcomed and appreciated.

comment:7 Changed 4 years ago by rjollos

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 4 years ago by rjollos

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

comment:9 Changed 4 years ago by rjollos

  • Resolution set to fixed
  • Status changed from assigned to closed

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

Add Comment

Modify Ticket

as closed The owner will remain rjollos.
The resolution will be deleted. Next status will be 'reopened'.

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

Note: See TracTickets for help on using tickets.