mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-01-01 21:21:50 +08:00
Merge pull request #7099 from ivanscinote/SCI-10103-ik2
Fix asset sync update to account for WOPI and post process [SCI-10103]
This commit is contained in:
commit
da8f2ff217
1 changed files with 13 additions and 1 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)
|
||||||
|
@ -36,9 +38,19 @@ class AssetSyncController < ApplicationController
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
|
orig_file_size = @asset.file_size
|
||||||
|
|
||||||
ActiveRecord::Base.transaction do
|
ActiveRecord::Base.transaction do
|
||||||
@asset.update(last_modified_by: current_user)
|
@asset.update(last_modified_by: current_user)
|
||||||
@asset.file.attach(io: request.body, filename: @asset.file.filename)
|
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
|
||||||
|
|
||||||
log_activity(:edit)
|
log_activity(:edit)
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue