Fix asset sync update to account for WOPI and post process [SCI-10103]

This commit is contained in:
Ivan Kljun 2024-02-16 09:53:26 +01:00
parent 378b2dc12e
commit c043a9375a

View file

@ -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