fixes #2569
This commit is contained in:
@@ -73,6 +73,12 @@ class Upload < ActiveRecord::Base
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def validate_md5_confirmation_after_move
|
||||||
|
if !md5_confirmation.blank? && md5_confirmation != Digest::MD5.file(md5_file_path).hexdigest
|
||||||
|
raise "md5 mismatch"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def rating_given
|
def rating_given
|
||||||
if rating.present?
|
if rating.present?
|
||||||
return true
|
return true
|
||||||
@@ -121,6 +127,7 @@ class Upload < ActiveRecord::Base
|
|||||||
end
|
end
|
||||||
generate_resizes(file_path)
|
generate_resizes(file_path)
|
||||||
move_file
|
move_file
|
||||||
|
validate_md5_confirmation_after_move
|
||||||
save
|
save
|
||||||
post = convert_to_post
|
post = convert_to_post
|
||||||
post.distribute_files
|
post.distribute_files
|
||||||
@@ -191,6 +198,7 @@ class Upload < ActiveRecord::Base
|
|||||||
end
|
end
|
||||||
|
|
||||||
def move_file
|
def move_file
|
||||||
|
return if File.exists?(md5_file_path)
|
||||||
FileUtils.mv(file_path, md5_file_path)
|
FileUtils.mv(file_path, md5_file_path)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user