FileExists: returns the path, not file digest.

This commit is contained in:
Karchnu 2020-06-14 18:11:36 +02:00
parent c926e5334a
commit de53bf59a2
2 changed files with 6 additions and 3 deletions

View File

@ -42,10 +42,10 @@ class FileStorage::Errors
JSONIPC.request FileExists, 204 do JSONIPC.request FileExists, 204 do
property mid : String property mid : String
property reason = "file already present" property reason = "file already present"
property filedigest : String property path : String
property next_chunk : Int32 property next_chunk : Int32
def initialize(@mid, @filedigest, @next_chunk) def initialize(@mid, @path, @next_chunk)
end end
end end
FileStorage.errors << FileExists FileStorage.errors << FileExists

View File

@ -112,6 +112,9 @@ class FileStorage::Storage
rescue e : IndexError rescue e : IndexError
# In case the file was completely uploaded already. # In case the file was completely uploaded already.
return FileStorage::Errors::FileFullyUploaded.new mid, file_digest return FileStorage::Errors::FileFullyUploaded.new mid, file_digest
rescue e
puts "error during transfer_info.chunks.sort.first"
raise e
end end
end end
@ -192,7 +195,7 @@ class FileStorage::Storage
# in this case: ignore the upload request. # in this case: ignore the upload request.
begin begin
next_chunk = transfer_info.chunks.sort.first next_chunk = transfer_info.chunks.sort.first
return FileStorage::Errors::FileExists.new mid, file_digest, next_chunk return FileStorage::Errors::FileExists.new mid, path, next_chunk
rescue e : IndexError rescue e : IndexError
# In case the file was completely uploaded already. # In case the file was completely uploaded already.
return FileStorage::Errors::FileFullyUploaded.new mid, file_digest return FileStorage::Errors::FileFullyUploaded.new mid, file_digest