Edgewall Software
Modify

Opened 19 years ago

Closed 19 years ago

Last modified 18 years ago

#1829 closed defect (fixed)

ImageMacro may fail on WikiStart page

Reported by: Shun-ichi Goto <gotoh@…> Owned by: Christian Boos
Priority: normal Milestone: 0.9
Component: wiki system Version: devel
Severity: normal Keywords:
Cc: Branch:
Release Notes:
API Changes:
Internal Changes:

Description

As same issue with #1802, ImageMacro raises exception. There's a workaround patch until formatter provides correct path info. This patch also contains bug fix of split count to retrieve 'id' part correctly.

--- macros.py	(revision 2017)
+++ macros.py	(working copy)
@@ -314,7 +314,9 @@
             # FIXME: should be retrieved from the formatter...
             # ...and the formatter should be provided to the macro
             file = filespec
-            module, id = req.hdf['HTTP.PathInfo'].split('/', 3)[1:]
+            items = req.hdf['HTTP.PathInfo'].split('/', 2) + [None, None]
+            module = items[1] or 'wiki'
+            id = items[2] or 'WikiStart'
             if module not in ['wiki', 'ticket']:
                 raise Exception('Cannot reference local attachment from here')
         else:

Attachments (0)

Change History (2)

comment:1 by Christian Boos, 19 years ago

Milestone: 0.9
Owner: changed from Jonas Borgström to Christian Boos
Status: newassigned

My idea is that any wiki text in Trac always belongs to some Trac object (see TracObjectModelProposal). Sometimes, there's only one wiki text for a given Trac object, like the content for a Wiki page. Sometimes there are more of them, e.g. a ticket object has the description plus any number of distinct comments.

You can see those concepts "at work" in the TracCrossReferences branch, where I call those wiki texts the facets of an object.

On that branch, I'll refactor the wiki formatting methods into member methods of the generic TracObject.

I don't think it's a good idea to refactor the trunk so that the wiki formatting methods take into account the (type,id) of the "object" to which the wiki text being formatted belongs, because that would be an extensive change which would conflict with the direction taken by the TracCrossReferences branch.

So in the meantime, I'll apply your patch.

comment:2 by Matthew Good, 19 years ago

Resolution: fixed
Status: assignedclosed

Looks like cboos checked in [2018], but forgot to close this ticket.

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Christian Boos.
The resolution will be deleted. Next status will be 'reopened'.
to The owner will be changed from Christian Boos to the specified user.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.