summaryrefslogtreecommitdiff
path: root/app/models/upload.rb
diff options
context:
space:
mode:
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