Push final path of the uploaded file in Response::Upload.

dev
Karchnu 2020-05-20 09:20:52 +02:00
parent 6bd194529b
commit 3c7a2eb8f7
2 changed files with 5 additions and 3 deletions

View File

@ -45,7 +45,8 @@ end
class FileStorage::Response
JSONIPC.request Upload, 20 do
property mid : String
def initialize(@mid)
property path : String
def initialize(@mid, @path)
end
end

View File

@ -112,9 +112,10 @@ class FileStorage::Storage
# In this case: ignore the upload request
end
FileStorage::Response::Upload.new request.mid
path = "/files/#{user.uid}/#{request.file.digest}.bin"
FileStorage::Response::Upload.new request.mid, path
rescue e
puts "Error handling transfer: #{e.message}"
puts "Error handling upload: #{e.message}"
FileStorage::Response::Error.new mid.not_nil!, "Unexpected error: #{e.message}"
end