diff --git a/app/controllers/asset_sync_controller.rb b/app/controllers/asset_sync_controller.rb index 01f3e8da8..855bfba53 100644 --- a/app/controllers/asset_sync_controller.rb +++ b/app/controllers/asset_sync_controller.rb @@ -87,11 +87,15 @@ class AssetSyncController < ApplicationController Asset.transaction do new_asset = @asset.dup new_asset.save - new_asset.file.attach( + + blob = ActiveStorage::Blob.create_and_upload!( io: request.body, - filename: "#{@asset.file.filename.base} (#{t('general.copy')}).#{@asset.file.filename.extension}" + filename: "#{@asset.file.filename.base} (#{t('general.copy')}).#{@asset.file.filename.extension}", + metadata: @asset.blob.metadata ) + new_asset.file.attach(blob) + case @asset.parent when Step StepAsset.create!(step: @asset.step, asset: new_asset) @@ -101,6 +105,8 @@ class AssetSyncController < ApplicationController @asset = new_asset.reload + new_asset.post_process_file + current_user.asset_sync_tokens.create!(asset_id: new_asset.id) end end