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

Improved some minor things in the storage requests part

Andreas Pfohl5f1c629fe466
diff --git a/modules/storages/lib/api/v3/utilities/storage_interaction/nextcloud_storage_query.rb b/modules/storages/lib/api/v3/utilities/storage_interaction/nextcloud_storage_query.rb
index 7863a1bfb5f..d169f2e0d14 100644
--- a/modules/storages/lib/api/v3/utilities/storage_interaction/nextcloud_storage_query.rb
+++ b/modules/storages/lib/api/v3/utilities/storage_interaction/nextcloud_storage_query.rb
@@ -92,9 +92,13 @@ module API::V3::Utilities::StorageInteraction
end
def name(element)
- element
- .xpath('d:href')
- .map(&:inner_text)
+ texts = element
+ .xpath('d:href')
+ .map(&:inner_text)
+
+ return nil if texts.empty?
+
+ texts
.first
.delete_prefix(@base_path)
.delete_suffix('/')
diff --git a/modules/storages/lib/api/v3/utilities/storage_interaction/storage_queries.rb b/modules/storages/lib/api/v3/utilities/storage_interaction/storage_queries.rb
index fa0b8ad75aa..76e632faa5a 100644
--- a/modules/storages/lib/api/v3/utilities/storage_interaction/storage_queries.rb
+++ b/modules/storages/lib/api/v3/utilities/storage_interaction/storage_queries.rb
@@ -19,8 +19,8 @@ module API::V3::Utilities::StorageInteraction
result:
::API::V3::Utilities::StorageInteraction::NextcloudStorageQuery.new(
base_uri: @uri,
- origin_user_id: token.send(:origin_user_id),
- token: token.send(:access_token),
+ origin_user_id: token.origin_user_id,
+ token: token.access_token,
with_refreshed_token: connection_manager.method(:with_refreshed_token).to_proc
)
)
diff --git a/modules/storages/spec/lib/api/v3/utilities/storage_requests_spec.rb b/modules/storages/spec/lib/api/v3/utilities/storage_requests_spec.rb
index 66d0fe4066d..03f1ad8d88e 100644
--- a/modules/storages/spec/lib/api/v3/utilities/storage_requests_spec.rb
+++ b/modules/storages/spec/lib/api/v3/utilities/storage_requests_spec.rb
@@ -121,7 +121,7 @@ describe API::V3::Utilities::StorageRequests, webmock: true do
.to_return(status: 207, body: xml, headers: {})
end
- describe 'files_query' do
+ describe '#files_query' do
describe 'with Nextcloud storage type selected' do
it 'must return a list of files when called' do
subject