#11443 closed defect (fixed)
Allow non-project relative (absolute) links again.
Reported by: | ryank-inovonics | Owned by: | Ryan J Ollos |
---|---|---|---|
Priority: | normal | Component: | NavAddPlugin |
Severity: | normal | Keywords: | |
Cc: | Trac Release: | 1.0 |
Description
With the fix for #940, this plugin only allowed links relative to the Trac environment to be used. While this is handy for multiple instance setups, it does prevent the use of absolute links to resources outside the Trac environment.
The attached patch checks the provided href
to see if it starts with https:
, http:
, or /
. If it does then the URL is used in the nav bar item directly. Otherwise it is left as a link relative to the Trac environment.
Attachments (1)
Change History (11)
Changed 11 years ago by
Attachment: | NavAdd.diff added |
---|
comment:1 Changed 11 years ago by
Owner: | changed from Michael Renzmann to Ryan J Ollos |
---|---|
Status: | new → assigned |
comment:2 Changed 11 years ago by
For the case that the href
starts with /
, do you treat it as relative to the network location (e.g. http://www.myserver.com
)?
For example, if the base of a project is /proj1
, then wiki/WikiStart
maps to /proj1/wiki/WikiStart
, but an href
starting with /
would need to start with the project name (.e.g /proj2
)?
comment:3 Changed 11 years ago by
That is correct, some examples for a Trac installed at https://www.myserver.com/trac/
:
href | Link in page source. | Link as displayed/used by web browser. |
---|---|---|
/reviewboard/ | /reviewboard/ | https://www.myserver.com/reviewboard/
|
report/43 | /trac/report/43 | https://trac.inovonics.com/trac/report/43
|
https://www.other.com/ | https://www.other.com/ | https://www.other.com/
|
I chose this logic as it let you specify links relative to the Trac instance, the server hosting Trac instance(s), or an absolute location with a single config value.
comment:4 Changed 11 years ago by
The rules you suggest make sense. The changes would be inconsistent with the rules used for the MenusPlugin, but that plugin should probably be changed since it doesn't allow for links on the same base URL without specifying the full URL.
comment:5 Changed 11 years ago by
Status: | assigned → accepted |
---|
comment:6 Changed 11 years ago by
Your suggestions agree with the documentation for [mainnav]
and [metanav]
at TracNavigation. However, I found that similar problems exist in Trac: trac:#11432.
comment:8 Changed 11 years ago by
If you have a chance to test out the latest code and report back whether it is working for you, that would be appreciated.
Restore support for absolute URLs.