From e21f067fabcb4756d7f7241bd7835a5b56689471 Mon Sep 17 00:00:00 2001 From: lllusion3469 <31420484+lllusion3469@users.noreply.github.com> Date: Fri, 14 Dec 2018 22:23:47 +0100 Subject: [PATCH] #3767: Prioritize md5 check over source download in case both an upload from disk and a source were specified, this caused an md5 mismatch error to be thrown --- app/logical/upload_service/preprocessor.rb | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/app/logical/upload_service/preprocessor.rb b/app/logical/upload_service/preprocessor.rb index a9d0802cf..62dea578f 100644 --- a/app/logical/upload_service/preprocessor.rb +++ b/app/logical/upload_service/preprocessor.rb @@ -33,25 +33,25 @@ class UploadService memoize :canonical_source def in_progress? - if Utils.is_downloadable?(source) - return Upload.where(status: "preprocessing", source: source).exists? - end - if md5.present? return Upload.where(status: "preprocessing", md5: md5).exists? end + if Utils.is_downloadable?(source) + return Upload.where(status: "preprocessing", source: source).exists? + end + false end def predecessor - if Utils.is_downloadable?(source) - return Upload.where(status: ["preprocessed", "preprocessing"], source: source).first - end - if md5.present? return Upload.where(status: ["preprocessed", "preprocessing"], md5: md5).first end + + if Utils.is_downloadable?(source) + return Upload.where(status: ["preprocessed", "preprocessing"], source: source).first + end end def completed?