Ticket #10659 (closed defect: fixed)

Opened 6 months ago

Last modified 6 months ago

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

Reported by: nmadura@umich.edu Assigned to: 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

web_ui.0.11_1.0.patch (0.9 kB) - added by nmadura@umich.edu on 11/27/12 20:54:05.
patch to get ImgSVG working on trac 1.0

Change History

11/27/12 20:54:05 changed by nmadura@umich.edu

  • attachment web_ui.0.11_1.0.patch added.

patch to get ImgSVG working on trac 1.0

11/27/12 20:57:13 changed by nmadura@umich.edu

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

like so...

--- ../0.11/imagesvg/web_ui.py  2009-10-14 18:16:11.000000000 -0400
+++ imagesvg/web_ui.py  2012-11-27 14:39:06.000000000 -0500
@@ -152,10 +152,15 @@
     def process_request(self, req):
         if req.path_info.startswith("/svg"):
             pathSegs = req.path_info.split("/")
-            image_path = "/".join(pathSegs[2:])
-            f = os.path.join(self.env.path, image_path)
+            # pathSegs[1] == svg
+            # pathSegs[2] == attachments
+            # pathSegs[3] == wiki | ticket
+            # pathSegs[n] == filename.ext
+            attachment = Attachment(self.env, pathSegs[3], "/".join(pathSegs[4:-1]))
+            attachment.filename = pathSegs[-1]
+            self.log.info("SVG Attachment: %s" % (attachment.path))
             try:
-                message = open(f).read()
+                message = open(attachment.path).read()
             except:
                 raise HTTPException(404)

11/28/12 02:33:12 changed by richard

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

11/28/12 02:34:06 changed by richard

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

Add/Change #10659 (TracImgSvg no longer works due to a change in how attachments are stored.)




Change Properties
Action