mirror of
https://github.com/neocities/neocities.git
synced 2025-07-20 17:46:05 +02:00
catch for overly nested params with upload hash
This commit is contained in:
parent
343e85a3bc
commit
c8ff812643
2 changed files with 25 additions and 0 deletions
|
@ -241,6 +241,24 @@ describe 'api' do
|
|||
_(res[:files][:'test.jpg']).must_equal true
|
||||
_(res[:files][:'test2.jpg']).must_equal false
|
||||
end
|
||||
|
||||
it 'rejects nested parameter structures' do
|
||||
create_site
|
||||
basic_authorize @user, @pass
|
||||
|
||||
post '/api/upload_hash', {
|
||||
"one/two" => {
|
||||
"three" => {
|
||||
".jpg" => "196b99a0ab80d1fc2e7caf49d98e8dd76db25c72"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
_(last_response.status).must_equal 400
|
||||
_(res[:result]).must_equal 'error'
|
||||
_(res[:error_type]).must_equal 'nested_parameters_not_allowed'
|
||||
_(res[:message]).must_equal 'nested parameters are not allowed; each path must directly map to a SHA-1 hash string'
|
||||
end
|
||||
end
|
||||
|
||||
describe 'rename' do
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue