From 577d6e99f7a1196cc1845c4419721af5cd3f412a Mon Sep 17 00:00:00 2001
From: man13 <man13@inf.ufpr.br>
Date: Wed, 24 Feb 2016 13:44:36 -0300
Subject: [PATCH] changing verification of finished upload

Signed-off-by: man13 <man13@inf.ufpr.br>
---
 app/controllers/chunks_controller.rb | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/app/controllers/chunks_controller.rb b/app/controllers/chunks_controller.rb
index 013100214..21bff7642 100644
--- a/app/controllers/chunks_controller.rb
+++ b/app/controllers/chunks_controller.rb
@@ -38,9 +38,9 @@ class ChunksController < ApplicationController
     currentSize = params[:resumableChunkNumber].to_i * params[:resumableChunkSize].to_i
     filesize = params[:resumableTotalSize].to_i
 
-    #When all chunks are uploaded
-    if (currentSize + params[:resumableCurrentChunkSize].to_i) >= filesize
 
+    #When all chunks are uploaded
+    if params[:resumableChunkNumber].to_i >= params[:resumableTotalChunks].to_i
       #Create a target file
       File.open(resumable_filename, "a") do |target|
         #Loop trough the chunks
@@ -58,7 +58,6 @@ class ChunksController < ApplicationController
         end
         puts "File saved to #{resumable_filename}"
       end
-
       publisher = LearningObjectPublisher.new(DspaceService.create_client)
       publisher.post @learning_object, resumable_filename
     end
-- 
GitLab