summaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
authorGo MAEDA <maeda@farend.jp>2022-11-03 05:17:48 +0000
committerGo MAEDA <maeda@farend.jp>2022-11-03 05:17:48 +0000
commitfcf1352c6b19f1dcb8872367a1313cbffb551093 (patch)
treecff397005ab0d1e20f1f0a4dfd35d6d4ba017f93 /app
parentf90fd0d236eb35028122013e914076b94b119ad5 (diff)
downloadredmine-fcf1352c6b19f1dcb8872367a1313cbffb551093.tar.gz
redmine-fcf1352c6b19f1dcb8872367a1313cbffb551093.zip
Redirect to container URL in case of error in attachments#download_all (#37880).
Patch by Holger Just. git-svn-id: https://svn.redmine.org/redmine/trunk@21948 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app')
-rw-r--r--app/controllers/attachments_controller.rb19
1 files changed, 18 insertions, 1 deletions
diff --git a/app/controllers/attachments_controller.rb b/app/controllers/attachments_controller.rb
index 210cd7ba4..819128eed 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?