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

[chore] fixed file info response handling for nextcloud

Eric Schubert3d2c7fb44b49
diff --git a/modules/storages/app/common/storages/peripherals/storage_interaction/nextcloud/file_info_query.rb b/modules/storages/app/common/storages/peripherals/storage_interaction/nextcloud/file_info_query.rb
index 58f7850e7b4..eefa8e18dd4 100644
--- a/modules/storages/app/common/storages/peripherals/storage_interaction/nextcloud/file_info_query.rb
+++ b/modules/storages/app/common/storages/peripherals/storage_interaction/nextcloud/file_info_query.rb
@@ -83,7 +83,7 @@ module Storages::Peripherals::StorageInteraction::Nextcloud
def handle_failure
->(response_object) do
- case response_object.ocs.meta.statuscode
+ case response_object.ocs.data.statuscode
when 200
ServiceResult.success(result: response_object)
when 403
diff --git a/modules/storages/spec/features/manage_project_storage_spec.rb b/modules/storages/spec/features/manage_project_storage_spec.rb
index 825055e8a5a..5f48ae76f27 100644
--- a/modules/storages/spec/features/manage_project_storage_spec.rb
+++ b/modules/storages/spec/features/manage_project_storage_spec.rb
@@ -34,11 +34,7 @@ require_module_spec_helper
# Setup storages in Project -> Settings -> File Storages
# This tests assumes that a Storage has already been setup
# in the Admin section, tested by admin_storage_spec.rb.
-RSpec.describe(
- 'Activation of storages in projects',
- js: true,
- webmock: true
-) do
+RSpec.describe 'Activation of storages in projects', :js, :webmock do
let(:user) { create(:user) }
# The first page is the Project -> Settings -> General page, so we need
# to provide the user with the edit_project permission in the role.
@@ -67,19 +63,14 @@ RSpec.describe(
let(:folder1_fileinfo_response) do
{
ocs: {
- meta: {
- status: 'ok'
- },
data: {
- '11': {
- status: 'OK',
- statuscode: 200,
- id: 11,
- name: 'Folder1',
- path: 'files/Folder1',
- mtime: 1682509719,
- ctime: 0
- }
+ status: 'OK',
+ statuscode: 200,
+ id: 11,
+ name: 'Folder1',
+ path: 'files/Folder1',
+ mtime: 1682509719,
+ ctime: 0
}
}
}
@@ -92,7 +83,7 @@ RSpec.describe(
.to_return(status: 207, body: root_xml_response, headers: {})
stub_request(:propfind, "#{storage.host}/remote.php/dav/files/#{oauth_client_token.origin_user_id}/Folder1")
.to_return(status: 207, body: folder1_xml_response, headers: {})
- stub_request(:post, "#{storage.host}/ocs/v1.php/apps/integration_openproject/filesinfo")
+ stub_request(:get, "#{storage.host}/ocs/v1.php/apps/integration_openproject/fileinfo/11")
.to_return(status: 200, body: folder1_fileinfo_response.to_json, headers: {})
stub_request(:get, "#{storage.host}/ocs/v1.php/cloud/user").to_return(status: 200, body: "{}")
stub_request(
@@ -158,6 +149,7 @@ RSpec.describe(
page.find('.icon.icon-edit').click
expect(page).to have_current_path edit_project_settings_project_storage_path(project_id: project,
id: Storages::ProjectStorage.last)
+
expect(page).to have_text('Edit the file storage to this project')
expect(page).not_to have_select('storages_project_storage_storage_id')
expect(page).to have_text(storage.name)