mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2024-11-11 01:44:34 +08:00
Fix asset sync update to account for WOPI and post process [SCI-10103]
This commit is contained in:
parent
378b2dc12e
commit
c043a9375a
1 changed files with 13 additions and 2 deletions
|
@ -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
|
||||
|
||||
|
|
Loading…
Reference in a new issue