Merge pull request '1.13.0-bugfix' from 1.13.0-bugfix into release/1.13.0

Reviewed-on: https://git.onlyoffice.com/ONLYOFFICE/document-server-integration/pulls/57
This commit is contained in:
Sergey Linnik
2025-03-25 08:06:11 +00:00
4 changed files with 10 additions and 5 deletions

View File

@ -195,7 +195,7 @@ def getHistoryObject(storagePath, filename, docKey, docUrl, isEnableDirectUrl, r
if i > 1: # check if the version number is greater than 1 (the file was modified)
# get the path to the changes.json file
changes = json.loads(readFile(getChangesHistoryPath(prevVerDir)))
change = changes['changes'][0]
change = changes['changes'][-1]
# write information about changes to the object
obj['changes'] = changes['changes'] if change else None
obj['serverVersion'] = changes['serverVersion']

View File

@ -532,7 +532,10 @@ class HomeController < ApplicationController
source_basename = body['fileName']
version = body['version']
url = body['url']
url = body['url'].sub(
HomeController.config_manager.document_server_public_uri.to_s,
HomeController.config_manager.document_server_private_uri.to_s
)
user_id = body['userId']
source_extension = Pathname(source_basename).extname

View File

@ -169,11 +169,13 @@ class DocumentHelper
next if e.eql?('..')
next if File.directory?(File.join(directory, e)) # if the element is a directory, skip it
arr.push(e) # push the file to the array
file_path = File.join(directory, e)
arr.push([e, File.mtime(file_path)]) # push the file name and its modification time to the array
end
end
arr
arr.sort_by { |_, mtime| -mtime.to_i } # rubocop:disable Lint/NumberConversion
.map(&:first)
end
# create file meta information

View File

@ -294,7 +294,7 @@ class FileModel
changes = JSON.parse(file.read) # and parse its content
end
change = changes['changes'][0]
change = changes['changes'].last
# write information about changes to the object
obj['changes'] = change ? changes['changes'] : nil