Project

General

Profile

Actions

Defect #6590

closed

Wrong file list link in email notification on new file upload

Added by Christian Hausleitner about 14 years ago. Updated over 13 years ago.

Status:
Closed
Priority:
Low
Assignee:
-
Category:
Email notifications
Target version:
Start date:
2010-10-06
Due date:
% Done:

0%

Estimated time:
Resolution:
Fixed
Affected version:

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

Files

redmine.png (3.74 KB) redmine.png email link Vladimir Ch, 2011-01-31 04:16
mailer.rb.patch (1.58 KB) mailer.rb.patch Patch for mailer.rb Karel Pičman, 2011-03-18 08:33
Actions #1

Updated by Vladimir Ch almost 14 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

Actions #2

Updated by Vladimir Ch almost 14 years ago

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

Actions #3

Updated by Sebastian Maj almost 14 years ago

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

Actions #4

Updated by Kseniya Shestakova almost 14 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
Actions #5

Updated by Karel Pičman almost 14 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'
Actions #6

Updated by Etienne Massip almost 14 years ago

  • Target version set to Candidate for next minor release
Actions #7

Updated by Karel Pičman almost 14 years ago

Here is a patch

Actions #8

Updated by Jean-Philippe Lang over 13 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.

Actions #9

Updated by Jean-Philippe Lang over 13 years ago

  • Status changed from Resolved to Closed
Actions

Also available in: Atom PDF