Defect #3692 » mailer_trailing_slash_fix.patch
| app/models/mailer.rb (working copy) | ||
|---|---|---|
|
def self.default_url_options
|
||
|
h = Setting.host_name
|
||
|
h = h.to_s.gsub(%r{\/.*$}, '') unless Redmine::Utils.relative_url_root.blank?
|
||
|
# Ensure that a trailing slash of the Settings.host_name will be removed.
|
||
|
h.gsub!(/\/$/, '')
|
||
|
{ :host => h, :protocol => Setting.protocol }
|
||
|
end
|
||
|
|
||
| test/unit/mailer_test.rb (working copy) | ||
|---|---|---|
|
end
|
||
|
end
|
||
|
|
||
|
def test_generated_links_in_emails_with_trailing_slash
|
||
|
Setting.host_name = 'mydomain.foo/'
|
||
|
Setting.protocol = 'https'
|
||
|
|
||
|
journal = Journal.find(2)
|
||
|
assert Mailer.deliver_issue_edit(journal)
|
||
|
|
||
|
mail = ActionMailer::Base.deliveries.last
|
||
|
assert_kind_of TMail::Mail, mail
|
||
|
|
||
|
assert_select_email do
|
||
|
# link to the main ticket
|
||
|
assert_select "a[href=?]", "https://mydomain.foo/issues/1", :text => "Bug #1: Can't print recipes"
|
||
|
# link to a referenced ticket
|
||
|
assert_select "a[href=?][title=?]", "https://mydomain.foo/issues/2", "Add ingredients categories (Assigned)", :text => "#2"
|
||
|
# link to a changeset
|
||
|
assert_select "a[href=?][title=?]", "https://mydomain.foo/projects/ecookbook/repository/revisions/2", "This commit fixes #1, #2 and references #1 & #3", :text => "r2"
|
||
|
end
|
||
|
end
|
||
|
|
||
|
def test_generated_links_with_prefix
|
||
|
relative_url_root = Redmine::Utils.relative_url_root
|
||
|
Setting.host_name = 'mydomain.foo/rdm'
|
||