mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-09-07 05:34:55 +08:00
nil image guard [fixes SCI-1907]
This commit is contained in:
parent
7e2392f620
commit
a87c43e999
1 changed files with 6 additions and 0 deletions
|
@ -21,6 +21,9 @@ namespace :tiny_mce_asset do
|
||||||
step.description.gsub!(regex) do |el|
|
step.description.gsub!(regex) do |el|
|
||||||
match = el.match(regex)
|
match = el.match(regex)
|
||||||
old_img = TinyMceAsset.find_by_id(match[1])
|
old_img = TinyMceAsset.find_by_id(match[1])
|
||||||
|
# skip other processing and deletes tiny_mce tag
|
||||||
|
# if image is not in database
|
||||||
|
next unless old_img
|
||||||
new_img = TinyMceAsset.create(image: old_img.image,
|
new_img = TinyMceAsset.create(image: old_img.image,
|
||||||
team: team,
|
team: team,
|
||||||
reference: step)
|
reference: step)
|
||||||
|
@ -47,6 +50,9 @@ namespace :tiny_mce_asset do
|
||||||
result_text.text.gsub!(regex) do |el|
|
result_text.text.gsub!(regex) do |el|
|
||||||
match = el.match(regex)
|
match = el.match(regex)
|
||||||
old_img = TinyMceAsset.find_by_id(match[1])
|
old_img = TinyMceAsset.find_by_id(match[1])
|
||||||
|
# skip other processing and deletes tiny_mce tag
|
||||||
|
# if image is not in database
|
||||||
|
next unless old_img
|
||||||
new_img = TinyMceAsset.create(image: old_img.image,
|
new_img = TinyMceAsset.create(image: old_img.image,
|
||||||
team: team,
|
team: team,
|
||||||
reference: result_text)
|
reference: result_text)
|
||||||
|
|
Loading…
Add table
Reference in a new issue