mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-03-10 14:46:42 +08:00
Merge pull request #2620 from okriuchykhin/ok_SCI_4673
Fix file download from MS Office online [SCI-4673]
This commit is contained in:
commit
5ce1311591
3 changed files with 8 additions and 3 deletions
|
@ -102,6 +102,10 @@ class AssetsController < ApplicationController
|
||||||
render plain: @asset.file.blob.service_url
|
render plain: @asset.file.blob.service_url
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def download
|
||||||
|
redirect_to rails_blob_path(@asset.file, disposition: 'attachment')
|
||||||
|
end
|
||||||
|
|
||||||
def edit
|
def edit
|
||||||
action = @asset.file_size.zero? && !@asset.locked? ? 'editnew' : 'edit'
|
action = @asset.file_size.zero? && !@asset.locked? ? 'editnew' : 'edit'
|
||||||
@action_url = append_wd_params(@asset.get_action_url(current_user, action, false))
|
@action_url = append_wd_params(@asset.get_action_url(current_user, action, false))
|
||||||
|
|
|
@ -48,6 +48,8 @@ class WopiController < ActionController::Base
|
||||||
put_file
|
put_file
|
||||||
end
|
end
|
||||||
|
|
||||||
|
private
|
||||||
|
|
||||||
def check_file_info
|
def check_file_info
|
||||||
asset_owner_id = @asset.id.to_s
|
asset_owner_id = @asset.id.to_s
|
||||||
asset_owner_id = @asset.created_by_id.to_s if @asset.created_by_id
|
asset_owner_id = @asset.created_by_id.to_s if @asset.created_by_id
|
||||||
|
@ -69,7 +71,7 @@ class WopiController < ActionController::Base
|
||||||
UserCanWrite: @can_write,
|
UserCanWrite: @can_write,
|
||||||
UserCanNotWriteRelative: true,
|
UserCanNotWriteRelative: true,
|
||||||
CloseUrl: @close_url,
|
CloseUrl: @close_url,
|
||||||
DownloadUrl: url_for(controller: 'assets', action: 'file_url', id: @asset.id, host: ENV['WOPI_USER_HOST']),
|
DownloadUrl: url_for(controller: 'assets', action: 'download', id: @asset.id, host: ENV['WOPI_USER_HOST']),
|
||||||
HostEditUrl: url_for(controller: 'assets', action: 'edit', id: @asset.id, host: ENV['WOPI_USER_HOST']),
|
HostEditUrl: url_for(controller: 'assets', action: 'edit', id: @asset.id, host: ENV['WOPI_USER_HOST']),
|
||||||
HostViewUrl: url_for(controller: 'assets', action: 'view', id: @asset.id, host: ENV['WOPI_USER_HOST']),
|
HostViewUrl: url_for(controller: 'assets', action: 'view', id: @asset.id, host: ENV['WOPI_USER_HOST']),
|
||||||
BreadcrumbBrandName: @breadcrumb_brand_name,
|
BreadcrumbBrandName: @breadcrumb_brand_name,
|
||||||
|
@ -260,8 +262,6 @@ class WopiController < ActionController::Base
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
|
||||||
|
|
||||||
def authenticate_user_from_token!
|
def authenticate_user_from_token!
|
||||||
wopi_token = params[:access_token]
|
wopi_token = params[:access_token]
|
||||||
if wopi_token.nil?
|
if wopi_token.nil?
|
||||||
|
|
|
@ -685,6 +685,7 @@ Rails.application.routes.draw do
|
||||||
get 'files/:id/preview', to: 'assets#preview', as: 'preview_asset'
|
get 'files/:id/preview', to: 'assets#preview', as: 'preview_asset'
|
||||||
get 'files/:id/view', to: 'assets#view', as: 'view_asset'
|
get 'files/:id/view', to: 'assets#view', as: 'view_asset'
|
||||||
get 'files/:id/file_url', to: 'assets#file_url', as: 'asset_file_url'
|
get 'files/:id/file_url', to: 'assets#file_url', as: 'asset_file_url'
|
||||||
|
get 'files/:id/download', to: 'assets#download', as: 'asset_download'
|
||||||
get 'files/:id/edit', to: 'assets#edit', as: 'edit_asset'
|
get 'files/:id/edit', to: 'assets#edit', as: 'edit_asset'
|
||||||
post 'files/:id/update_image', to: 'assets#update_image',
|
post 'files/:id/update_image', to: 'assets#update_image',
|
||||||
as: 'update_asset_image'
|
as: 'update_asset_image'
|
||||||
|
|
Loading…
Reference in a new issue