From c043a9375aaa322c4671a0f416892a96dc35e67a Mon Sep 17 00:00:00 2001 From: Ivan Kljun Date: Fri, 16 Feb 2024 09:53:26 +0100 Subject: [PATCH 1/2] Fix asset sync update to account for WOPI and post process [SCI-10103] --- app/controllers/asset_sync_controller.rb | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/app/controllers/asset_sync_controller.rb b/app/controllers/asset_sync_controller.rb index 0d671a6c4..bdf3d773d 100644 --- a/app/controllers/asset_sync_controller.rb +++ b/app/controllers/asset_sync_controller.rb @@ -1,6 +1,8 @@ # frozen_string_literal: true class AssetSyncController < ApplicationController + include FileIconsHelper + skip_before_action :authenticate_user!, only: %i(update download) skip_before_action :verify_authenticity_token, only: %i(update download) before_action :authenticate_asset_sync_token!, only: %i(update download) @@ -32,8 +34,17 @@ class AssetSyncController < ApplicationController return end - @asset.file.attach(io: request.body, filename: @asset.file.filename) - @asset.touch + orig_file_size = @asset.file_size + + if wopi_file?(@asset) + @asset.update_contents(request.body) + else + @asset.file.attach(io: request.body, filename: @asset.file.filename) + @asset.touch + end + + @asset.team.release_space(orig_file_size) + @asset.post_process_file(@asset.team) log_activity From aae8d4d227514f5a5c57565307e1656d3a7e22e8 Mon Sep 17 00:00:00 2001 From: Ivan Kljun Date: Fri, 16 Feb 2024 10:39:19 +0100 Subject: [PATCH 2/2] Remove team arg from post_process_file [SCI-10103] --- app/controllers/asset_sync_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/asset_sync_controller.rb b/app/controllers/asset_sync_controller.rb index 48b2ae037..01f3e8da8 100644 --- a/app/controllers/asset_sync_controller.rb +++ b/app/controllers/asset_sync_controller.rb @@ -50,7 +50,7 @@ class AssetSyncController < ApplicationController end @asset.team.release_space(orig_file_size) - @asset.post_process_file(@asset.team) + @asset.post_process_file log_activity(:edit) end