Defect #6590

Wrong file list link in email notification on new file upload

Added by Christian Hausleitner about 7 years ago. Updated over 6 years ago.

Status:ClosedStart date:2010-10-06
Priority:LowDue date:
Assignee:-% Done:

0%

Category:Email notifications
Target version:1.1.3
Resolution:Fixed Affected version:1.0.2

Description

The link in the email pointing to the file list leads to a 403 error (You are not authorized to access this page.).

E.g. the file list link in the email is: http://host/redmine/projects/list_files/projectXY

(instead of http://host/redmine/projects/projectXY/files)

BR, Christian

Redmine version         1.0.2 stable
Ruby version            1.8.7 (i386-mingw32)
RubyGems version        1.3.7
Rack version            1.0
Rails version           2.3.5
Active Record version   2.3.5
Active Resource version 2.3.5
Action Mailer version   2.3.5
Active Support version  2.3.5
Action Pack version     2.3.5
Environment:            production
Database adapter        mysql
Database version        MySQL 5.1.41
Database schema version 20100819172912
Windows 2003 X64 SP2
mongrel                 1.1.5
mongrel_service         0.3.4
gem_plugin              0.2.3
cgi_multipart_eof_fix   2.5.0
win32-service           0.5.2

Plugins:
Redmine Newissuealerts  0.0.2
Issue Resources         0.2.0
Redmine Graphs          0.1.0
Default columns         0.0.2

redmine.png - email link (3.74 KB) Vladimir Ch, 2011-01-31 04:16

mailer.rb.patch Magnifier - Patch for mailer.rb (1.58 KB) Karel Pičman, 2011-03-18 08:33

Associated revisions

Revision 5230
Added by Jean-Philippe Lang over 6 years ago

Fixed links in new file notification broken by r4051 (#6590).

History

#1 Updated by Vladimir Ch almost 7 years ago

Same problem!

Redmine version 1.0.4 stable
Ruby version 1.8.7 (i386-mingw32)
Environment: production
Database adapter mysql
Database version MySQL 5.0.90

#2 Updated by Vladimir Ch almost 7 years ago

In version 1.1 the error still persists.
PS: Windows 2003 Server

#3 Updated by Sebastian Maj almost 7 years ago

Is there any chances that this problem will be fixed soon? It's really annoying.

#4 Updated by Kseniya Shestakova over 6 years ago

In app/models/mailer.rb

def attachments_added(attachments)
    container = attachments.first.container
    added_to = ''
    added_to_url = ''
    case container.class.name
    when 'Project'
-      added_to_url = url_for(:controller => 'projects', :action => 'list_files', :id => container)
+      added_to_url = url_for(:controller => 'files', :action => 'index', :project_id => container)
      added_to = "#{l(:label_project)}: #{container}" 
      recipients container.project.notified_users.select {|user| user.allowed_to?(:view_files, container.project)}.collect  {|u| u.mail}
    when 'Version'
-      added_to_url = url_for(:controller => 'projects', :action => 'list_files', :id => container)
+      added_to_url = url_for(:controller => 'files', :action => 'index', :project_id => container)
      added_to = "#{l(:label_version)}: #{container.name}" 
      recipients container.project.notified_users.select {|user| user.allowed_to?(:view_files, container.project)}.collect  {|u| u.mail}
    when 'Document'
      added_to_url = url_for(:controller => 'documents', :action => 'show', :id => container.id)
      added_to = "#{l(:label_document)}: #{container.title}" 
      recipients container.recipients
    end
    redmine_headers 'Project' => container.project.identifier
    subject "[#{container.project.name}] #{l(:label_attachment_new)}" 
    body :attachments => attachments,
         :added_to => added_to,
         :added_to_url => added_to_url
    render_multipart('attachments_added', body)
  end

#5 Updated by Karel Pičman over 6 years ago

In case of Version there should be container.project_id

when 'Version'
-      added_to_url = url_for(:controller => 'projects', :action => 'list_files', :id => container)
+      added_to_url = url_for(:controller => 'files', :action => 'index', :project_id => container.project_id)
      added_to = "#{l(:label_version)}: #{container.name}" 
      recipients container.project.notified_users.select {|user| user.allowed_to?(:view_files, container.project)}.collect  {|u| u.mail}
    when 'Document'

#6 Updated by Etienne Massip over 6 years ago

  • Target version set to Candidate for next minor release

#7 Updated by Karel Pičman over 6 years ago

Here is a patch

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

  • Status changed from New to Resolved
  • Target version changed from Candidate for next minor release to 1.1.3
  • Resolution set to Fixed

Fixed in r5230, thanks.

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

  • Status changed from Resolved to Closed

Also available in: Atom PDF