Vote #68317
完了Wrong file list link in email notification on new file upload
0%
説明
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
journals
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
--------------------------------------------------------------------------------
In version 1.1 the error still persists.
PS: Windows 2003 Server
--------------------------------------------------------------------------------
Is there any chances that this problem will be fixed soon? It's really annoying.
--------------------------------------------------------------------------------
In app/models/mailer.rb
<pre>
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
</pre>
--------------------------------------------------------------------------------
In case of Version there should be container.project_id
<pre>
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'
</pre>
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
Here is a patch
--------------------------------------------------------------------------------
Fixed in r5230, thanks.
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------