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

[#50987] enforced parent folder object in files query

Eric Schubert2d5ef1a82132
diff --git a/modules/storages/app/common/storages/peripherals/storage_interaction/nextcloud/files_query.rb b/modules/storages/app/common/storages/peripherals/storage_interaction/nextcloud/files_query.rb
index 4c22a48461b..f772fae7bd2 100644
--- a/modules/storages/app/common/storages/peripherals/storage_interaction/nextcloud/files_query.rb
+++ b/modules/storages/app/common/storages/peripherals/storage_interaction/nextcloud/files_query.rb
@@ -72,9 +72,9 @@ module Storages::Peripherals::StorageInteraction::Nextcloud
private
def requested_folder(folder)
- return '' if folder.nil?
+ return '' if folder.root?
- Util.escape_path(folder)
+ Util.escape_path(folder.path)
end
# rubocop:disable Metrics/AbcSize
diff --git a/modules/storages/app/common/storages/peripherals/storage_interaction/one_drive/files_query.rb b/modules/storages/app/common/storages/peripherals/storage_interaction/one_drive/files_query.rb
index 20c2122a093..c8c388862fa 100644
--- a/modules/storages/app/common/storages/peripherals/storage_interaction/one_drive/files_query.rb
+++ b/modules/storages/app/common/storages/peripherals/storage_interaction/one_drive/files_query.rb
@@ -107,21 +107,20 @@ module Storages
end
def empty_response(folder)
- files_result = if folder.root?
- StorageFiles.new([], root(Digest::SHA256.hexdigest('i_am_root')), [])
- else
- StorageFiles.new(
- [],
- StorageFile.new(
- id: Digest::SHA256.hexdigest(folder),
- name: folder.split('/').last,
- location: folder,
- permissions: %i[readable writeable]
- ),
- forge_ancestors(path: folder)
- )
- end
- ServiceResult.success(result: files_result)
+ path = folder.path
+
+ ServiceResult.success(
+ result: StorageFiles.new(
+ [],
+ StorageFile.new(
+ id: Digest::SHA256.hexdigest(path),
+ name: path.split('/').last,
+ location: path,
+ permissions: %i[readable writeable]
+ ),
+ forge_ancestors(path:)
+ )
+ )
end
def extract_location(parent_reference, file_name = '')
@@ -170,7 +169,7 @@ module Storages
def uri_path_for(folder)
return "/v1.0/drives/#{@storage.drive_id}/root/children" if folder.root?
- "/v1.0/drives/#{@storage.drive_id}/root:#{encode_path(folder)}:/children"
+ "/v1.0/drives/#{@storage.drive_id}/root:#{encode_path(folder.path)}:/children"
end
def encode_path(path)