debugging download

This commit is contained in:
G. Gibson 2022-04-24 11:35:16 -07:00
parent 70abafd659
commit 0d2e49839f

View file

@ -1222,13 +1222,18 @@ module GxGwww
cache_profile = (GxG::SERVICES[:core][:resources].entries(temp_dir, ::GxG::DB[:administrator]) || []).first cache_profile = (GxG::SERVICES[:core][:resources].entries(temp_dir, ::GxG::DB[:administrator]) || []).first
if cache_profile if cache_profile
handle = GxG::SERVICES[:core][:resources].open((temp_dir + "/" + cache_profile[:title]), ::GxG::DB[:administrator]) handle = GxG::SERVICES[:core][:resources].open((temp_dir + "/" + cache_profile[:title]), ::GxG::DB[:administrator])
if handle
# download_path = handle[:resource].path() # download_path = handle[:resource].path()
response = [200, {"content-type" => "application/json"}, ({:result => true, :file_name => cache_profile[:title], :data => handle[:resource].read}).to_json()] response = [200, {"content-type" => "application/json"}, ({:result => true, :file_name => cache_profile[:title], :data => handle[:resource].read}).to_json()]
GxG::SERVICES[:core][:resources].close(handle[:token]) GxG::SERVICES[:core][:resources].close(handle[:token])
GxG::SERVICES[:core][:resources].destroy(rtemp_dir, ::GxG::DB[:administrator])
# response = [-255, {"content-type" => "application/hash"}, {:result => {:file => download_path, :vfs_dir => temp_dir}}] # response = [-255, {"content-type" => "application/hash"}, {:result => {:file => download_path, :vfs_dir => temp_dir}}]
else else
raise "Failed to get cache profile." raise "Failed to get cache profile."
end end
else
raise "Failed to get cache profile."
end
else else
response = [500, {"content-type" => "application/json"}, ({:result => false, :error => "Failed to cache file."}).to_json()] response = [500, {"content-type" => "application/json"}, ({:result => false, :error => "Failed to cache file."}).to_json()]
end end
@ -1241,6 +1246,7 @@ module GxGwww
# #
end end
rescue Exception => the_error rescue Exception => the_error
log_error({:error => the_error})
response = [500, {"content-type" => "application/json"}, ({:result => false, :error => the_error.to_s}).to_json()] response = [500, {"content-type" => "application/json"}, ({:result => false, :error => the_error.to_s}).to_json()]
end end
# #