From 5bc7ffde736317b370459ef94ddfa2e865e0d328 Mon Sep 17 00:00:00 2001 From: sshakndr Date: Wed, 13 Mar 2024 18:27:58 +0700 Subject: [PATCH 1/2] fix(ruby): historyobj method. Fix Bug 66862 --- .../ruby/app/controllers/home_controller.rb | 2 +- .../ruby/app/models/file_model.rb | 33 +++++++++---------- 2 files changed, 16 insertions(+), 19 deletions(-) diff --git a/web/documentserver-example/ruby/app/controllers/home_controller.rb b/web/documentserver-example/ruby/app/controllers/home_controller.rb index a9d11b2bb..b0be3e979 100755 --- a/web/documentserver-example/ruby/app/controllers/home_controller.rb +++ b/web/documentserver-example/ruby/app/controllers/home_controller.rb @@ -169,7 +169,7 @@ def historyobj action_data: file_data['action_data'], direct_url: file_data['direct_url'] ) - history = file.get_history + history = file.history render(json: history) rescue StandardError render(json: '{ "error": "File not found"}') diff --git a/web/documentserver-example/ruby/app/models/file_model.rb b/web/documentserver-example/ruby/app/models/file_model.rb index 57e4a6942..7a3b38fe3 100755 --- a/web/documentserver-example/ruby/app/models/file_model.rb +++ b/web/documentserver-example/ruby/app/models/file_model.rb @@ -261,8 +261,7 @@ def history data_obj['url'] = if i == cur_ver DocumentHelper.get_download_url( - file_name, - true + file_name ) else DocumentHelper.get_historypath_uri( @@ -303,22 +302,20 @@ def history prev = hist_data[(i - 2).to_s] # get the history data from the previous file version # write key and url information about previous file version with optional direct url - data( - obj['previous'] = if enable_direct_url? == true - { # write key and url information about previous file version with optional directUrl - fileType: prev['fileType'], - key: prev['key'], - url: prev['url'], - directUrl: prev['directUrl'] - } - else - { - fileType: prev['fileType'], - key: prev['key'], - url: prev['url'] - } - end - ) + obj['previous'] = if enable_direct_url? == true + { # write key and url information about previous file version with optional directUrl + fileType: prev['fileType'], + key: prev['key'], + url: prev['url'], + directUrl: prev['directUrl'] + } + else + { + fileType: prev['fileType'], + key: prev['key'], + url: prev['url'] + } + end diff_path = [hist_dir, (i - 1).to_s, 'diff.zip'].join(File::SEPARATOR) if File.exist?(diff_path) From a63d8d42840a5b9401b4889646120350e22a0c5b Mon Sep 17 00:00:00 2001 From: sshakndr Date: Thu, 14 Mar 2024 16:30:22 +0700 Subject: [PATCH 2/2] fix(ruby): previous in history data --- web/documentserver-example/ruby/app/models/file_model.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web/documentserver-example/ruby/app/models/file_model.rb b/web/documentserver-example/ruby/app/models/file_model.rb index 7a3b38fe3..d4772bc32 100755 --- a/web/documentserver-example/ruby/app/models/file_model.rb +++ b/web/documentserver-example/ruby/app/models/file_model.rb @@ -302,7 +302,7 @@ def history prev = hist_data[(i - 2).to_s] # get the history data from the previous file version # write key and url information about previous file version with optional direct url - obj['previous'] = if enable_direct_url? == true + data_obj['previous'] = if enable_direct_url? == true { # write key and url information about previous file version with optional directUrl fileType: prev['fileType'], key: prev['key'],