#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
This commit is contained in:
lllusion3469
2018-12-14 22:23:47 +01:00
committed by GitHub
parent 9de5857032
commit e21f067fab

View File

@@ -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?