debian-mirror-gitlab/lib/gitlab/verify/uploads.rb

40 lines
719 B
Ruby
Raw Normal View History

2019-02-13 22:33:31 +05:30
# frozen_string_literal: true
2018-03-27 19:54:05 +05:30
module Gitlab
module Verify
class Uploads < BatchVerifier
def name
'Uploads'
end
def describe(object)
"Upload: #{object.id}"
end
private
2018-12-05 23:21:45 +05:30
# rubocop: disable CodeReuse/ActiveRecord
2018-11-08 19:23:39 +05:30
def all_relation
Upload.all.preload(:model)
end
2018-12-05 23:21:45 +05:30
# rubocop: enable CodeReuse/ActiveRecord
2018-11-08 19:23:39 +05:30
def local?(upload)
upload.local?
2018-03-27 19:54:05 +05:30
end
def expected_checksum(upload)
upload.checksum
end
def actual_checksum(upload)
Upload.hexdigest(upload.absolute_path)
end
2018-11-08 19:23:39 +05:30
def remote_object_exists?(upload)
upload.build_uploader.file.exists?
end
2018-03-27 19:54:05 +05:30
end
end
end