Fix eln export for file without extension

This commit is contained in:
aignatov-bio 2019-11-06 09:53:44 +01:00
parent ec66ab8654
commit 0c5ce90895

View file

@ -130,7 +130,12 @@ class TinyMceAsset < ApplicationRecord
if exists?
order(:id).each do |tiny_mce_asset|
asset_guid = get_guid(tiny_mce_asset.id)
asset_file_name = "rte-#{asset_guid}.#{tiny_mce_asset.image.blob.filename.extension}"
extension = tiny_mce_asset.image.blob.filename.extension
asset_file_name = if extension.empty?
"rte-#{asset_guid}"
else
"rte-#{asset_guid}.#{tiny_mce_asset.image.blob.filename.extension}"
end
ostream.put_next_entry("#{dir}/#{asset_file_name}")
ostream.print(tiny_mce_asset.image.download)
end