Edgewall Software

Ticket #7442 (new defect)

Opened 3 months ago

Last modified 2 months ago

[header_logo] src and [project] icon does not use htdocs_location

Reported by: cat@… Owned by:
Priority: normal Milestone:
Component: web frontend Version: 0.11
Severity: minor Keywords: htdocs_location
Cc: mail@…

Description

I have following lines in trac.ini

[header_logo]
src = trac_banner.png

[project]
icon = trac.ico

[trac]
htdocs_location = /trac/

And I get in HTML lines like these

<link rel="shortcut icon" href="/trac.cgi/chrome/common/trac.ico" type="image/x-icon" />
<link rel="icon" href="/trac.cgi/chrome/common/trac.ico" type="image/x-icon" />
...
<img src="/trac.cgi/chrome/common/trac_banner.png" ...

I assume they should be relative to htdocs_location as well as other static content.

Attachments

Change History

Changed 2 months ago by mail@…

  • cc mail@… added

I can confirm this. 0.11 on Gentoo.

Tried to fix it like this:

  • /usr/lib64/python2.5/site-packages/trac/templates/theme.html

    old new  
    1717    <div id="banner"> 
    1818      <div id="header" py:choose=""> 
    1919        <a py:when="chrome.logo.src" id="logo" href="${chrome.logo.link or href.wiki('TracIni')+'#header_logo-section'}"><img 
    20           src="${chrome.logo.src}" alt="${chrome.logo.alt}" 
     20          src="${chrome.htdocs_location}${chrome.logo.src}" alt="${chrome.logo.alt}" 
    2121          height="${chrome.logo.height or None}" width="${chrome.logo.width or None}" /></a> 
    2222        <h1 py:otherwise=""><a href="${chrome.logo.link}">${project.name}</a></h1> 
    2323      </div> 

The result was an URL like /project/trac-htdocs//project/trac/chrome/common/site/mylogo.png. What I expected it to be: /project/trac-htdocs/chrome/common/site/mylogo.png.

Related config snippets:

[trac]
htdocs_location = /project/trac-htdocs

[header_logo]
src = site/mylogo.png

Maybe someone else knows how to do the fix correctly.

Changed 2 months ago by osimons

You'll want to look at #6562 as that is closely related - and your expected behaviour is even noted as a possible #TODO on the ticket and in the source.

The simple workaround is to use an absolute or server-relative URL for the logo - like /myhtdocs/mylogo.png. That logo source variable will be used as-is by the template.

Add/Change #7442 ([header_logo] src and [project] icon does not use htdocs_location)

Author



Change Properties
<Author field>
Action
as new
as The resolution will be set. Next status will be 'closed'
to The owner will change from (none). Next status will be 'new'
The owner will change from (none) to anonymous. Next status will be 'assigned'
 
Note: See TracTickets for help on using tickets.