From 710af857437e9c37c47e6b8f6e3d6457e57e96cd Mon Sep 17 00:00:00 2001 From: aignatov-bio <47317017+aignatov-bio@users.noreply.github.com> Date: Wed, 14 Aug 2019 09:06:12 +0200 Subject: [PATCH] Fix template generating (#1980) --- app/services/team_importer.rb | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/app/services/team_importer.rb b/app/services/team_importer.rb index 906243b9f..8f3c03dd6 100644 --- a/app/services/team_importer.rb +++ b/app/services/team_importer.rb @@ -795,10 +795,19 @@ class TeamImporter # returns asset object def create_asset(asset_json, team, user_id = nil) - asset = Asset.new(asset_json['asset']) + ### Fix for support templates + asset_info = asset_json['asset'] || asset_json + + asset = Asset.new(asset_info) asset_blob = asset_json['asset_blob'] + ### Fix for support templates + asset_file_name = if asset_blob + asset_blob['filename'] + else + asset_json['file_file_name'] + end File.open( - "#{@import_dir}/assets/#{asset.id}/#{asset_blob['filename']}" + "#{@import_dir}/assets/#{asset.id}/#{asset_file_name}" ) do |file| orig_asset_id = asset.id asset.id = nil