Add file size check

This commit is contained in:
Urban Rotnik 2019-10-22 14:13:22 +02:00
parent 0119533e75
commit a7d351dc38

View file

@ -98,7 +98,11 @@ module TinyMceImages
# We need implement size and type checks here
url = image['src']
image_type = FastImage.type(url).to_s
next unless image_type
new_image = URI.parse(url).open
next if new_image.size > Rails.configuration.x.file_max_size_mb.megabytes
new_image_filename = Asset.generate_unique_secure_token + '.' + image_type
end