Defect #20192
openIssueLink in email notification contains SUB-URI part twice
0%
Description
I am using Redmine installed in SUB-URI environment for a long time now I plan to upgrade from 2.5.3 into 3.0.3. So I have started testing it before I upgrade my production environment. Everything looks good only one problem I have recognized.
When I receive an email notification from Redmine 3.0.3 installed in sub-uri environment, the URL contains the SUB-URI part twice
like this http://server.domain/redmine/redmine/issues/1234#change-12345
All of the other URL-s are working properly in my Redmine environment.
My general site settings contains only server.domain without the sub-uri part.
If I use Redmine 2.5 or 2.6 versions with exactly the same setup everything work as expected.
I have installed everything with SVN checkout and the suggested building procedure.
All of the functionality in redmine works perfect only the URLs in email notifications are wrong (SUB-URI part doubled).
I have checked the app/models/mailer.rb file and I have found an important change compared to earlier versions:
In 2.5 and 2.6 it was:
def self.default_url_options
{ :host => Setting.host_name, :protocol => Setting.protocol }
end
In 3.0.3 it is:
def self.default_url_options
options = {:protocol => Setting.protocol}
if Setting.host_name.to_s =~ /\A(https?\:\/\/)?(.+?)(\:(\d+))?(\/.+)?\z/i
host, port, prefix = $2, $4, $5
options.merge!({
:host => host, :port => port, :script_name => prefix
})
else
options[:host] = Setting.host_name
end
options
end
I have changed the :script_name attribute in the 31st line like this:
:script_name => ''
So the function now looks like:
def self.default_url_options
options = {:protocol => Setting.protocol}
if Setting.host_name.to_s =~ /\A(https?\:\/\/)?(.+?)(\:(\d+))?(\/.+)?\z/i
host, port, prefix = $2, $4, $5
options.merge!({
:host => host, :port => port, :script_name => ''
})
else
options[:host] = Setting.host_name
end
options
end
And the problem is solved but I would like to be sure is this solution does not generates other unexpected behaviour.
My environment is:
Environment:
Redmine version 3.0.3.stable.14377
Ruby version 2.0.0-p0 (2013-02-24) [x86_64-linux]
Rails version 4.2.3
Environment production
Database adapter Mysql2
SCM:
Subversion 1.6.9
Git 1.7.11.3
Filesystem
Redmine plugins:
clipboard_image_paste 1.10
quick_edit 0.0.8
redmine_agile 1.3.9
redmine_ckeditor 1.1.0
redmine_dashboard 2.5.0
redmine_helpdesk 0.0.12
redmine_my_page 0.1.5
redmine_per_project_formatting 0.0.4
redmine_theme_changer 0.2.0
redmine_wiki_unc 0.0.3
redmine_work_time 0.3.0
redmine_xlsx_format_issue_exporter 0.1.2
Thx. for your help
Related issues