fix for api calls with square bracket filenames

This commit is contained in:
Kyle Drake 2024-03-04 16:38:47 -06:00
parent 3087e39b57
commit e7e5121700
3 changed files with 30 additions and 7 deletions

View file

@ -308,6 +308,15 @@ describe 'api' do
_(site_file_exists?('test.jpg')).must_equal true
end
it 'succeeds with square bracket in filename' do
create_site
@site.generate_api_key!
header 'Authorization', "Bearer #{@site.api_key}"
post '/api/upload', 'te[s]t.jpg' => Rack::Test::UploadedFile.new('./tests/files/test.jpg', 'image/jpeg')
_(res[:result]).must_equal 'success'
_(site_file_exists?('te[s]t.jpg')).must_equal true
end
it 'succeeds with valid user session' do
create_site
post '/api/upload',