OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
Fixed FilesInfoQuery
Andreas Pfohl4b6d07f08f88
diff --git a/modules/storages/app/common/storages/peripherals/storage_interaction/nextcloud/files_info_query.rb b/modules/storages/app/common/storages/peripherals/storage_interaction/nextcloud/files_info_query.rbindex 90d957104f0..7be0fefca30 100644--- a/modules/storages/app/common/storages/peripherals/storage_interaction/nextcloud/files_info_query.rb+++ b/modules/storages/app/common/storages/peripherals/storage_interaction/nextcloud/files_info_query.rb@@ -47,7 +47,7 @@ module Storages::Peripherals::StorageInteraction::NextcloudendUtil.token(user:, oauth_client: @oauth_client) do |token|- files_info(file_ids, token) >> json >> create_storage_file_infos+ files_info(file_ids, token).map(&parse_json) >> create_storage_file_infosendend@@ -58,14 +58,15 @@ module Storages::Peripherals::StorageInteraction::Nextcloudresult: RestClient::Request.execute(method: :post,url: Util.join_uri_path(@uri, FILES_INFO_PATH),- body: { fileIds: file_ids }.to_json,+ payload: { fileIds: file_ids }.to_json,headers: {'Authorization' => "Bearer #{token.access_token}",'Accept' => 'application/json',- 'Content-Type' => 'application/json'+ 'Content-Type' => 'application/json',+ 'OCS-APIRequest' => true})- )+ ).map(&:body)rescue RestClient::Unauthorized => eUtil.error(:not_authorized, 'Outbound request not authorized!', e.response)rescue RestClient::NotFound => e@@ -76,35 +77,37 @@ module Storages::Peripherals::StorageInteraction::NextcloudUtil.error(:error, 'Outbound request failed!')end- def json- ->(response) do+ def parse_json+ ->(response_body) do# rubocop:disable Style/OpenStructUse- response- .map(&:body)- .map { |body| JSON.parse(body, object_class: OpenStruct) }+ JSON.parse(response_body, object_class: OpenStruct)# rubocop:enable Style/OpenStructUseendend# rubocop:disable Metrics/AbcSizedef create_storage_file_infos- ->(json) do+ ->(response_object) doServiceResult.success(- result: ::Storages::StorageFileInfo.new(json.status,- json.status_code,- json.id,- json.name,- Time.zone.at(json.mtime),- Time.zone.at(json.ctime),- json.mimetype,- json.size,- json.owner_name,- json.owner_id,- json.trashed,- json.modifier_name,- json.modifier_id,- json.dav_permissions,- location(json.path))+ result: response_object.ocs.data.to_h.map do |_, value|+ ::Storages::StorageFileInfo.new(+ value.status,+ value.status_code,+ value.id,+ value.name,+ Time.zone.at(value.mtime),+ Time.zone.at(value.ctime),+ value.mimetype,+ value.size,+ value.owner_name,+ value.owner_id,+ value.trashed,+ value.modifier_name,+ value.modifier_id,+ value.dav_permissions,+ location(value.path)+ )+ end)endenddiff --git a/modules/storages/lib/api/v3/storage_files/storage_files_api.rb b/modules/storages/lib/api/v3/storage_files/storage_files_api.rbindex b60e87ede6f..8cb356ff285 100644--- a/modules/storages/lib/api/v3/storage_files/storage_files_api.rb+++ b/modules/storages/lib/api/v3/storage_files/storage_files_api.rb@@ -48,9 +48,8 @@ module API::V3::StorageFilesStorages::Peripherals::StorageRequests.new(storage: @storage).files_info_query- .call(user: current_user, file_id: [params[:file_id]])- .map(&:first)- .map(&method(to_storage_file))+ .call(user: current_user, file_ids: [params[:file_id]]).map(&:first)+ .map { |file_info| to_storage_file(file_info) }.match(on_success: ->(storage_file) {API::V3::StorageFiles::StorageFileRepresenter.new(storage_file, @storage, current_user:)