summaryrefslogtreecommitdiff
path: root/app/models/upload.rb
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2019-10-09 00:06:06 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2019-10-09 00:06:06 +0000
commit869182cab0867d582e469f329a6f58d13f877683 (patch)
treeb98d8834894848f5ce845b7efc84681d51083695 /app/models/upload.rb
parenta82d0c740b338ad981321a3111b731ad78364ba1 (diff)
downloadgitlab-ce-869182cab0867d582e469f329a6f58d13f877683.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/models/upload.rb')
-rw-r--r--app/models/upload.rb7
1 files changed, 2 insertions, 5 deletions
diff --git a/app/models/upload.rb b/app/models/upload.rb
index 384949ddb86..df8f9c56fa8 100644
--- a/app/models/upload.rb
+++ b/app/models/upload.rb
@@ -1,6 +1,7 @@
# frozen_string_literal: true
class Upload < ApplicationRecord
+ include Checksummable
# Upper limit for foreground checksum processing
CHECKSUM_THRESHOLD = 100.megabytes
@@ -21,10 +22,6 @@ class Upload < ApplicationRecord
# hooks are not executed and the file will not be deleted
after_destroy :delete_file!, if: -> { uploader_class <= FileUploader }
- def self.hexdigest(path)
- Digest::SHA256.file(path).hexdigest
- end
-
class << self
##
# FastDestroyAll concerns
@@ -55,7 +52,7 @@ class Upload < ApplicationRecord
self.checksum = nil
return unless needs_checksum?
- self.checksum = Digest::SHA256.file(absolute_path).hexdigest
+ self.checksum = self.class.hexdigest(absolute_path)
end
# Initialize the associated Uploader class with current model