Ticket #8066 (closed defect: fixed)

Opened 3 years ago

Last modified 7 months ago

TracLink to a PDF in the repository is not redirected

Reported by: boleslaw.tokarski@gmail.com Assigned to: rjollos
Priority: normal Component: PdfRedirectorPlugin
Severity: normal Keywords: source browser, preview
Cc: hasienda Trac Release: 0.12

Description

Hello,

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!

Cheers!

Attachments

Change History

11/16/10 22:15:21 changed by rjollos

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

11/21/11 11:45:06 changed by zgoey@ee.ethz.ch

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

07/25/12 23:11:44 changed by rjollos

  • status changed from new to assigned.
  • owner changed from nicholasbs to rjollos.
  • cc set to hasienda.

07/25/12 23:14:01 changed by rjollos

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

  • trunk/pdfredirector/pdfredirector.py

    old new  
    1313        return template, data, content_type 
    1414 
    1515    def pre_process_request(self, req, handler): 
     16         
    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 
    19  
    20         if not path[-1].lower().endswith('.pdf'): 
    21             return handler 
    22  
    23         filename = req.href(*(['raw-attachment'] + path[1:])) 
    24  
    25         req.redirect(filename)  
     18                 
     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) 
    2629 
    27  
    28  
    29  
    30  
     30        return handler 

07/26/12 08:15:06 changed by rjollos

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

07/26/12 08:15:55 changed by rjollos

Code review and feedback welcomed and appreciated.

10/16/12 21:53:12 changed 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?

10/16/12 23:16:12 changed by rjollos

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

10/16/12 23:17:00 changed by rjollos

  • status changed from assigned to closed.
  • resolution set to fixed.

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


Add/Change #8066 (TracLink to a PDF in the repository is not redirected)




Change Properties
Action