Skip to content

Commit

Permalink
Merge pull request #547 from ONLYOFFICE/fix/ruby-historyobj
Browse files Browse the repository at this point in the history
fix(ruby): historyobj method. Fix Bug 66862
  • Loading branch information
LinneyS authored Mar 14, 2024
2 parents ed39928 + a63d8d4 commit 717996a
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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"}')
Expand Down
33 changes: 15 additions & 18 deletions web/documentserver-example/ruby/app/models/file_model.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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
)
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

diff_path = [hist_dir, (i - 1).to_s, 'diff.zip'].join(File::SEPARATOR)
if File.exist?(diff_path)
Expand Down

0 comments on commit 717996a

Please sign in to comment.