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

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

40 lines
729 B
Ruby
Raw Normal View History

2019-02-15 15:39:39 +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)
2021-11-18 22:05:49 +05:30
Upload.sha256_hexdigest(upload.absolute_path)
2018-03-27 19:54:05 +05:30
end
2018-11-08 19:23:39 +05:30
def remote_object_exists?(upload)
2019-12-21 20:55:43 +05:30
upload.retrieve_uploader.file.exists?
2018-11-08 19:23:39 +05:30
end
2018-03-27 19:54:05 +05:30
end
end
end