diff options
Diffstat (limited to 'app/controllers/attachments_controller.rb')
-rw-r--r-- | app/controllers/attachments_controller.rb | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/app/controllers/attachments_controller.rb b/app/controllers/attachments_controller.rb index 0af43e18c..3bd63337f 100644 --- a/app/controllers/attachments_controller.rb +++ b/app/controllers/attachments_controller.rb @@ -239,11 +239,28 @@ class AttachmentsController < ApplicationController if @attachments.sum(&:filesize) > bulk_download_max_size flash[:error] = l(:error_bulk_download_size_too_big, :max_size => number_to_human_size(bulk_download_max_size.to_i)) - redirect_to back_url + redirect_back_or_default(container_url, referer: true) return end end + def container_url + case @container + when Message + url_for(@container.event_url) + when Project + # project attachments are listed in the files view + project_files_url(@container) + when Version + # version attachments are listed in its project's files view + project_files_url(@container.project) + when WikiPage + project_wiki_page_url @container.wiki.project, @container + else + url_for(@container) + end + end + # Checks that the file exists and is readable def file_readable if @attachment.readable? |