Modify

#10659 closed defect (fixed)

TracImgSvg no longer works due to a change in how attachments are stored.

Reported by: nmadura@… Owned by: richard
Priority: high Component: TracImageSvgMacro
Severity: critical Keywords:
Cc: Trac Release: 1.0

Description

See this ticket http://trac.edgewall.org/ticket/10313 for more details, but the attachments directory has moved to files/attachments and the attachment names are SHA-1'ed along with their page name.

Attached is a unified diff of a solution to the problem. note that wiki pages can have depth "some/page/to/wiki" which is why you can't assume the wiki page is in the 5th position of the array.

Attachments (1)

web_ui.0.11_1.0.patch (933 bytes) - added by nmadura@… 20 months ago.
patch to get ImgSVG working on trac 1.0

Download all attachments as: .zip

Change History (4)

Changed 20 months ago by nmadura@…

patch to get ImgSVG working on trac 1.0

comment:1 Changed 20 months ago by nmadura@…

Ahh crap, I did the patch backwards so the +'s and -'s need to be flipped.

like so...

  • imagesvg/web_ui.py

    old new  
    152152    def process_request(self, req): 
    153153        if req.path_info.startswith("/svg"): 
    154154            pathSegs = req.path_info.split("/") 
    155             image_path = "/".join(pathSegs[2:]) 
    156             f = os.path.join(self.env.path, image_path) 
     155            # pathSegs[1] == svg 
     156            # pathSegs[2] == attachments 
     157            # pathSegs[3] == wiki | ticket 
     158            # pathSegs[n] == filename.ext 
     159            attachment = Attachment(self.env, pathSegs[3], "/".join(pathSegs[4:-1])) 
     160            attachment.filename = pathSegs[-1] 
     161            self.log.info("SVG Attachment: %s" % (attachment.path)) 
    157162            try: 
    158                 message = open(f).read() 
     163                message = open(attachment.path).read() 
    159164            except: 
    160165                raise HTTPException(404) 

comment:2 Changed 20 months ago by richard

(In [12393]) Add support for trac 1.0, apply patch from nmadura, see #10659

comment:3 Changed 20 months ago by richard

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

Add Comment

Modify Ticket

Action
as closed .
as The resolution will be set. Next status will be 'closed'.
to The owner will be changed from richard. Next status will be 'closed'.
The resolution will be deleted. Next status will be 'reopened'.
Author


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

 
Note: See TracTickets for help on using tickets.