From 869182cab0867d582e469f329a6f58d13f877683 Mon Sep 17 00:00:00 2001 From: GitLab Bot Date: Wed, 9 Oct 2019 00:06:06 +0000 Subject: Add latest changes from gitlab-org/gitlab@master --- app/models/upload.rb | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'app/models/upload.rb') 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 -- cgit v1.2.1