mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-03-09 06:04:46 +08:00
Add file size check
This commit is contained in:
parent
0119533e75
commit
a7d351dc38
1 changed files with 4 additions and 0 deletions
|
@ -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
|
||||
|
||||
|
|
Loading…
Reference in a new issue