Defect #3483

Relative url for source links in notifications

Added by William Baum over 8 years ago. Updated over 3 years ago.

Status:ClosedStart date:2009-06-12
Priority:NormalDue date:
Assignee:Jean-Philippe Lang% Done:

80%

Category:Email notifications
Target version:2.5.2
Resolution:Fixed Affected version:2.2.1

Description

The email of an issue that includes a "source:" link is included in the email as a relative link ala:

<a href="/repositories/entry/..." class="source">source:...</a>

The link needs to be made absolute.

Not sure if this applies to other links besides source: links..

Ruby version 1.8.6 (i386-mswin32)
RubyGems version 1.3.1
Rails version 2.1.2

source_export-only_path.patch Magnifier (895 Bytes) William Baum, 2009-10-19 06:25


Related issues

Related to Redmine - Feature #4052: Cross-project redmine links with alternate link text for ... New 2009-10-19

Associated revisions

Revision 13219
Added by Jean-Philippe Lang over 3 years ago

Fixed relative "source" links in email notifications (#3483).

Patch by William Baum.

History

#1 Updated by William Baum over 8 years ago

This issue should be resolved with the attached patch.

The link_to for source: and export: links wasn't setting :only_path => only_path, so the links weren't being converted to absolute links in emails, etc..

Index: app/helpers/application_helper.rb
===================================================================
--- app/helpers/application_helper.rb    (revision 2879)
+++ app/helpers/application_helper.rb    (working copy)
@@ -527,7 +527,7 @@
             if project && project.repository
               name =~ %r{^[/\\]*(.*?)(@([0-9a-f]+))?(#(L\d+))?$}
               path, rev, anchor = $1, $3, $5
-              link = link_to h("#{prefix}:#{name}"), {:controller => 'repositories', :action => 'entry', :id => project,
+              link = link_to h("#{prefix}:#{name}"), {:only_path => only_path, :controller => 'repositories', :action => 'entry', :id => project,
                                                       :path => to_path_param(path),
                                                       :rev => rev,
                                                       :anchor => anchor,

Please also see Feature #4052 for additional enhancements to source and export links, as well as enhancements to commit, and revision links from #3346.

--Bill

#2 Updated by Daniel Felix about 5 years ago

I tested it with this comment. I was able to reproduce it. I get a mail with some invalid link. This should be corrected.

#3 Updated by Daniel Felix about 5 years ago

  • Status changed from New to Confirmed
  • Priority changed from Low to Normal
  • Affected version (unused) changed from 0.8.4 to 2.2.1
  • Affected version changed from 0.8.4 to 2.2.1

#4 Updated by Etienne Massip about 5 years ago

  • Target version set to Candidate for next minor release

#5 Updated by Toshi MARUYAMA almost 4 years ago

  • Related to Feature #4052: Cross-project redmine links with alternate link text for source and export links. added

#6 Updated by Jean-Philippe Lang over 3 years ago

  • Status changed from Confirmed to Resolved
  • Assignee set to Jean-Philippe Lang
  • Target version changed from Candidate for next minor release to 2.5.2
  • Resolution set to Fixed

Patch applied in r13219, thanks.

#7 Updated by Jean-Philippe Lang over 3 years ago

  • Status changed from Resolved to Closed

Merged.

#8 Updated by Jean-Philippe Lang over 3 years ago

  • Subject changed from Relative rather than absolute href links in issue emails... to Relative url for source links in notifications

Also available in: Atom PDF