summaryrefslogtreecommitdiffstats
path: root/app/models/attachment.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/models/attachment.rb')
-rw-r--r--app/models/attachment.rb5
1 files changed, 5 insertions, 0 deletions
diff --git a/app/models/attachment.rb b/app/models/attachment.rb
index d68a050c1..1e4f731e7 100644
--- a/app/models/attachment.rb
+++ b/app/models/attachment.rb
@@ -404,6 +404,11 @@ class Attachment < ActiveRecord::Base
self.class.extension_in?(File.extname(filename), extensions)
end
+ # returns either MD5 or SHA256 depending on the way self.digest was computed
+ def digest_type
+ digest.size < 64 ? "MD5" : "SHA256" if digest.present?
+ end
+
private
# Physically deletes the file from the file system