Skip to content

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

Added more error handling to FilesInfoQuery

Andreas Pfohl7afe773ead97
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.rb
index 7be0fefca30..f961270f943 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::Nextcloud
end
Util.token(user:, oauth_client: @oauth_client) do |token|
- files_info(file_ids, token).map(&parse_json) >> create_storage_file_infos
+ files_info(file_ids, token).map(&parse_json) >> handle_failure >> create_storage_file_infos
end
end
@@ -85,6 +85,16 @@ module Storages::Peripherals::StorageInteraction::Nextcloud
end
end
+ def handle_failure
+ ->(response_object) do
+ if response_object.ocs.meta.status == 'ok'
+ ServiceResult.success(result: response_object)
+ else
+ Util.error(:error, 'Outbound request failed!', response_object)
+ end
+ end
+ end
+
# rubocop:disable Metrics/AbcSize
def create_storage_file_infos
->(response_object) do