Project

General

Profile

Actions

Defect #19024

closed

link_to in Redmine::Hook::ViewListener omits url root

Added by Jakob Gillich about 9 years ago. Updated about 9 years ago.

Status:
Closed
Priority:
Normal
Category:
Plugin API
Target version:
Start date:
Due date:
% Done:

0%

Estimated time:
Resolution:
Fixed
Affected version:

Description

Linking to a controller action omits the configured url root (RAILS_RELATIVE_URL_ROOT environment variable).

For example, put the following code in a plugin & set RAILS_RELATIVE_URL_ROOT=/redmine:

link_to "Test", { :controller => 'my', :action => 'plugin' }
# => <a href="/my/plugin">Test</a>
# Should be: href="/redmine/my/plugin" 

There are quite a few others that seem to have the same problem:
https://github.com/peelman/my_projects/issues/5
https://stackoverflow.com/questions/25315103/link-to-omits-redmine-root

I am not sure if this is only reproducible under specific environments (at least the my_projects author doesn't seem to have this problem); I tried both the Bitnami Installer on Windows and the sameersbn/redmine Docker container. You should get the same results with the following steps:

  1. Download https://github.com/peelman/my_projects
  2. On Windows: Install Redmine using Bitnami and put the plugin in the plugins folder
    On Linux: Install Docker & fig, put this in the addon folder and type fig up.
  3. Open Redmine, create a project and go to the Home page.
  4. Observe that all links generated by the plugin don't include the relative URL.
Actions

Also available in: Atom PDF