catch for overly nested params with upload hash

This commit is contained in:
Kyle Drake 2025-06-13 14:42:45 -05:00
parent 343e85a3bc
commit c8ff812643
2 changed files with 25 additions and 0 deletions

View file

@ -9,6 +9,13 @@ post '/api/upload_hash' do
require_api_credentials
res = {}
files = []
params.each do |path, sha1_hash|
unless sha1_hash.is_a?(String)
api_error 400, 'nested_parameters_not_allowed', 'nested parameters are not allowed; each path must directly map to a SHA-1 hash string'
end
end
params.each do |k,v|
res[k] = current_site.sha1_hash_match? k, v
end