Download CSV file leads to 404 error #3
This commit is contained in:
parent
adcef53b67
commit
16be442602
@ -81,7 +81,7 @@ class DmsfFilesController < ApplicationController
|
||||
send_file pdf_preview, filename: "#{basename}.pdf", type: 'application/pdf', disposition: 'inline'
|
||||
# Text preview
|
||||
elsif !api_request? && params[:download].blank? && (@file.size <= Setting.file_max_size_displayed.to_i.kilobyte) &&
|
||||
(@file.text? || @file.markdown? || @file.textile?) && !@file.html?
|
||||
(@file.text? || @file.markdown? || @file.textile?) && !@file.html? && formats.include?(:html)
|
||||
@content = File.read(@revision.disk_file, mode: 'rb')
|
||||
render action: 'document'
|
||||
# Offer the file for download
|
||||
|
||||
@ -61,13 +61,20 @@ class DmsfFilesControllerTest < RedmineDmsf::Test::TestCase
|
||||
assert_response :forbidden
|
||||
end
|
||||
|
||||
def test_view_file_ok
|
||||
def test_view_file_standard_url
|
||||
# Permissions OK
|
||||
post '/login', params: { username: 'jsmith', password: 'jsmith' }
|
||||
get "/dmsf/files/#{@file1.id}/view", params: { id: @file1.id }
|
||||
assert_response :success
|
||||
end
|
||||
|
||||
def test_view_file_pretty_url
|
||||
# Permissions OK
|
||||
post '/login', params: { username: 'jsmith', password: 'jsmith' }
|
||||
get "/dmsf/files/#{@file1.id}/test.txt", params: { id: @file1.id }
|
||||
assert_response :success
|
||||
end
|
||||
|
||||
def test_view_file_forbidden
|
||||
# Missing permissions
|
||||
post '/login', params: { username: 'jsmith', password: 'jsmith' }
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user