From 4bbd149c44e68f3f8da99ac497b46b50b6e938f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karel=20Pi=C4=8Dman?= Date: Wed, 19 Feb 2025 08:42:21 +0100 Subject: [PATCH] Link entries download error #1592 --- app/controllers/dmsf_controller.rb | 4 ++-- test/functional/dmsf_controller_test.rb | 10 ++++++++++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/app/controllers/dmsf_controller.rb b/app/controllers/dmsf_controller.rb index c43e8a9b..17e6b4ad 100644 --- a/app/controllers/dmsf_controller.rb +++ b/app/controllers/dmsf_controller.rb @@ -169,11 +169,11 @@ class DmsfController < ApplicationController end if @selected_dir_links.present? && (params[:email_entries].present? || params[:download_entries].present?) - @selected_folders = DmsfLink.where(id: selected_dir_links).pluck(:target_id) | @selected_folders + @selected_folders = DmsfLink.where(id: @selected_dir_links).pluck(:target_id) | @selected_folders end if @selected_file_links.present? && (params[:email_entries].present? || params[:download_entries].present?) - @selected_files = DmsfLink.where(id: selected_file_links).pluck(:target_id) | @selected_files + @selected_files = DmsfLink.where(id: @selected_file_links).pluck(:target_id) | @selected_files end begin diff --git a/test/functional/dmsf_controller_test.rb b/test/functional/dmsf_controller_test.rb index 32fe40b1..db868b08 100644 --- a/test/functional/dmsf_controller_test.rb +++ b/test/functional/dmsf_controller_test.rb @@ -33,6 +33,7 @@ class DmsfControllerTest < RedmineDmsf::Test::TestCase super @link2 = DmsfLink.find 2 @link1 = DmsfLink.find 1 + @link4 = DmsfLink.find 4 @custom_field = CustomField.find 21 @custom_value = CustomValue.find 21 default_url_options[:host] = 'www.example.com' @@ -697,4 +698,13 @@ class DmsfControllerTest < RedmineDmsf::Test::TestCase assert_response :redirect assert_redirected_to 'http://www.example.com/login?back_url=http%3A%2F%2Fwww.example.com%2Fdmsf%2Fdigest' end + + def test_entries_download + # Target project is not given + post '/login', params: { username: 'jsmith', password: 'jsmith' } + post "/projects/#{@project1.id}/dmsf/entries", + params: { ids: ["folder-link-#{@link1.id}"], ids: ["file-link-#{@link4.id}"], download_entries: true } + assert_response :redirect + assert_nil flash[:error] + end end