Opened 8 years ago

Last modified 3 years ago

#6345 new defect

Generated links miss the page name on the default page

Reported by: Aurélien Bompard Owned by:
Priority: normal Component: TocMacro
Severity: normal Keywords:
Cc: Trac Release: 0.11



My Trac instance has the wiki as default component (it's the default Trac setup). I'm using the [[TOC(SomePage)]] macro on the WikiStart page. It works well when I click on the main "Wiki" link (URL is http!:// but when I click on the logo, I get to the default page (URL is http!://, which causes a problem : the links do not contain the page name. Instead of http!://, I get http!://

I found a way to fix the bug, using the following patch :

diff -p -up ./0.11/tractoc/ ./0.11/tractoc/
--- ./0.11/tractoc/  2009-12-17 14:42:42.000000000 +0100
+++ ./0.11/tractoc/     2009-12-17 14:43:15.000000000 +0100
@@ -43,7 +43,7 @@ def outline_tree(env, ol, outline, conte
                 stack[d+1] = (None, new_ol)
             href = get_resource_url(env, context.resource, context.href)
-            if href.endswith(context.req.path_info):
+            if context.req.path_info and href.endswith(context.req.path_info):
                 href = ''
             href += '#' + anchor
             li, ol = stack[depth]

I noticed that in my case the context.req.path_info variable is an empty string.

Please consider it for inclusion if it looks like the correct fix.

Attachments (0)

Change History (2)

comment:1 Changed 8 years ago by dnedelchev

It is a dupplicate of #4407 where is additional information as well as indicated workarand(s). I wrote a note there to link to this one too.

I can confirm that the problem persist (how it's described in these two bug-requests) both in 0.11 and in 0.12 However I leave the release indiction to 0.11 since TocMacro doesn't have an 0.12 dedicated variant yet.

comment:2 Changed 3 years ago by Ryan J Ollos

Owner: Noah Kantrowitz deleted

Modify Ticket

Change Properties
Set your email in Preferences
as new The ticket will remain with no owner.

Add Comment

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

Note: See TracTickets for help on using tickets.