Create MD5 hexdigest for new uploads
This commit is contained in:
parent
39f57be413
commit
e5f324e726
1 changed files with 4 additions and 0 deletions
|
|
@ -46,6 +46,7 @@ class PackagesController < ApplicationController
|
|||
end
|
||||
|
||||
params[:file].each do |img|
|
||||
# Log.log "Uploaded img=#{img.path}"
|
||||
new_screenshot = @package.screenshots.new(image: img)
|
||||
|
||||
# Check if the image was valid
|
||||
|
|
@ -53,6 +54,9 @@ class PackagesController < ApplicationController
|
|||
new_screenshot.uploaderhash = session.id.to_s
|
||||
new_screenshot.uploaderip = request.remote_ip
|
||||
new_screenshot.version = @package.version
|
||||
# ActiveStorage does not yet create a file checksum automatically.
|
||||
# Let's do that. It helps detect duplicate uploads later.
|
||||
new_screenshot.image_fingerprint = Digest::MD5.hexdigest(img.path)
|
||||
|
||||
# Can the upload get approved automatically?
|
||||
if user_signed_in?
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue