mirror of
https://github.com/discourse/discourse.git
synced 2025-05-23 23:21:11 +08:00
FEATURE: support for enabling all upload file types
BUGFIX: authorized extensions is now case insensitive
This commit is contained in:
@ -28,7 +28,7 @@ describe UploadsController do
|
||||
|
||||
let(:text_file) do
|
||||
ActionDispatch::Http::UploadedFile.new({
|
||||
filename: 'LICENSE.txt',
|
||||
filename: 'LICENSE.TXT',
|
||||
tempfile: File.new("#{Rails.root}/LICENSE.txt")
|
||||
})
|
||||
end
|
||||
@ -39,7 +39,7 @@ describe UploadsController do
|
||||
|
||||
context 'when authorized' do
|
||||
|
||||
before { SiteSetting.stubs(:authorized_extensions).returns(".png|.txt") }
|
||||
before { SiteSetting.stubs(:authorized_extensions).returns(".PNG|.txt") }
|
||||
|
||||
it 'is successful with an image' do
|
||||
xhr :post, :create, file: logo
|
||||
@ -75,6 +75,22 @@ describe UploadsController do
|
||||
|
||||
end
|
||||
|
||||
context 'when everything is authorized' do
|
||||
|
||||
before { SiteSetting.stubs(:authorized_extensions).returns("*") }
|
||||
|
||||
it 'is successful with an image' do
|
||||
xhr :post, :create, file: logo
|
||||
response.status.should eq 200
|
||||
end
|
||||
|
||||
it 'is successful with an attachment' do
|
||||
xhr :post, :create, file: text_file
|
||||
response.status.should eq 200
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
context 'with some files' do
|
||||
|
Reference in New Issue
Block a user