mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2024-12-27 10:14:17 +08:00
Fix template generating (#1980)
This commit is contained in:
parent
960e69eaa8
commit
710af85743
1 changed files with 11 additions and 2 deletions
|
@ -795,10 +795,19 @@ class TeamImporter
|
||||||
|
|
||||||
# returns asset object
|
# returns asset object
|
||||||
def create_asset(asset_json, team, user_id = nil)
|
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']
|
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(
|
File.open(
|
||||||
"#{@import_dir}/assets/#{asset.id}/#{asset_blob['filename']}"
|
"#{@import_dir}/assets/#{asset.id}/#{asset_file_name}"
|
||||||
) do |file|
|
) do |file|
|
||||||
orig_asset_id = asset.id
|
orig_asset_id = asset.id
|
||||||
asset.id = nil
|
asset.id = nil
|
||||||
|
|
Loading…
Reference in a new issue