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

[#55529] fixed interface of file info query

Eric Schubert47978ef900d9
diff --git a/frontend/src/app/shared/components/storages/functions/storages.functions.ts b/frontend/src/app/shared/components/storages/functions/storages.functions.ts
index ad337f059ca..8f949a8dc5d 100644
--- a/frontend/src/app/shared/components/storages/functions/storages.functions.ts
+++ b/frontend/src/app/shared/components/storages/functions/storages.functions.ts
@@ -56,7 +56,7 @@ export function getIconForStorageType(storageType?:string):string {
}
export function makeFilesCollectionLink(storageLink:IHalResourceLink, location:string):IHalResourceLink {
- const query = location !== '/' ? `?parent=${encodeURIComponent(location)}` : '';
+ const query = location !== '/' ? `?parent=${location}` : '';
return {
href: `${storageLink.href}/files${query}`,
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 5a0d3c3cc3f..f5dcf953640 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
@@ -101,7 +101,7 @@ module Storages::Peripherals::StorageInteraction::Nextcloud
result: ::Storages::StorageFileInfo.new(
status: data.status,
status_code: data.statuscode,
- id: data.id,
+ id: data.id.to_s,
name: data.name,
last_modified_at: Time.zone.at(data.mtime),
created_at: Time.zone.at(data.ctime),
diff --git a/modules/storages/app/common/storages/peripherals/storage_interaction/one_drive/file_info_query.rb b/modules/storages/app/common/storages/peripherals/storage_interaction/one_drive/file_info_query.rb
index 7861b45a913..a2a5d79361f 100644
--- a/modules/storages/app/common/storages/peripherals/storage_interaction/one_drive/file_info_query.rb
+++ b/modules/storages/app/common/storages/peripherals/storage_interaction/one_drive/file_info_query.rb
@@ -82,7 +82,7 @@ module Storages
def userless_strategy = Registry.resolve("one_drive.authentication.userless").call
- def storage_file_infos(json, status: "ok", status_code: 200)
+ def storage_file_infos(json, status: "ok", status_code: 200) # rubocop:disable Metrics/AbcSize
StorageFileInfo.new(
status:,
status_code:,
@@ -94,7 +94,7 @@ module Storages
owner_id: json.dig(:createdBy, :user, :id),
trashed: false,
permissions: nil,
- location: Util.extract_location(json[:parentReference], json[:name]),
+ location: Util.escape_path(Util.extract_location(json[:parentReference], json[:name])),
last_modified_at: Time.zone.parse(json.dig(:fileSystemInfo, :lastModifiedDateTime)),
created_at: Time.zone.parse(json.dig(:fileSystemInfo, :createdDateTime)),
last_modified_by_name: json.dig(:lastModifiedBy, :user, :displayName),
diff --git a/modules/storages/app/common/storages/peripherals/storage_interaction/one_drive/util.rb b/modules/storages/app/common/storages/peripherals/storage_interaction/one_drive/util.rb
index c10c71c4f06..560caf5011c 100644
--- a/modules/storages/app/common/storages/peripherals/storage_interaction/one_drive/util.rb
+++ b/modules/storages/app/common/storages/peripherals/storage_interaction/one_drive/util.rb
@@ -36,6 +36,12 @@ module Storages
using ServiceResultRefinements
class << self
+ def escape_path(path)
+ escaped_path = path.split("/").map { |i| CGI.escapeURIComponent(i) }.join("/")
+ escaped_path << "/" if path[-1] == "/"
+ escaped_path
+ end
+
def mime_type(json)
json.dig(:file, :mimeType) || (json.key?(:folder) ? "application/x-op-directory" : nil)
end