mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-12-17 22:28:38 +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
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class AssetSyncController < ApplicationController
|
class AssetSyncController < ApplicationController
|
||||||
|
include FileIconsHelper
|
||||||
|
|
||||||
skip_before_action :authenticate_user!, only: %i(update download)
|
skip_before_action :authenticate_user!, only: %i(update download)
|
||||||
skip_before_action :verify_authenticity_token, only: %i(update download)
|
skip_before_action :verify_authenticity_token, only: %i(update download)
|
||||||
before_action :authenticate_asset_sync_token!, only: %i(update download)
|
before_action :authenticate_asset_sync_token!, only: %i(update download)
|
||||||
|
|
@ -32,8 +34,17 @@ class AssetSyncController < ApplicationController
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
|
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.file.attach(io: request.body, filename: @asset.file.filename)
|
||||||
@asset.touch
|
@asset.touch
|
||||||
|
end
|
||||||
|
|
||||||
|
@asset.team.release_space(orig_file_size)
|
||||||
|
@asset.post_process_file(@asset.team)
|
||||||
|
|
||||||
log_activity
|
log_activity
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue