Added download_file

This commit is contained in:
G. Gibson 2022-04-17 13:08:29 -07:00
commit 46a8aaddfb
3 changed files with 93 additions and 20 deletions

View file

@ -113,7 +113,13 @@ class Node0 < Sinatra::Application
# end
# ### Implementation of the verbs:
get '*' do
GxG::SERVICES[:www][:receiver].handle_request(:get, request, session)
response = GxG::SERVICES[:www][:receiver].handle_request(:get, request, session)
if response[0] == -255
send_file(response[2][:result][:file], {:disposition => 'attachment', :filename => File.basename(response[2][:result][:file])})
GxG::SERVICES[:core][:resources].destroy(response[2][:result][:vfs_dir], ::GxG::DB[:administrator])
response = [200, {"content-type" => "application/json"}, {:result => true}.to_json()]
end
response
end
#
put '*' do