Link entries download error #1592

This commit is contained in:
Karel Pičman 2025-02-19 08:42:21 +01:00
parent 9ea770e4df
commit 4bbd149c44
2 changed files with 12 additions and 2 deletions

View File

@ -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

View File

@ -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