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] harden request uri of sharepoint files query

Eric Schubert0b491fd00068
diff --git a/modules/storages/app/common/storages/adapters/providers/share_point/base.rb b/modules/storages/app/common/storages/adapters/providers/share_point/base.rb
index e35ed773154..af919210d59 100644
--- a/modules/storages/app/common/storages/adapters/providers/share_point/base.rb
+++ b/modules/storages/app/common/storages/adapters/providers/share_point/base.rb
@@ -57,6 +57,10 @@ module Storages
host_uri.path&.split("/")&.last
end
+ def site_path
+ UrlBuilder.path(host_uri.path)
+ end
+
def host_uri
URI(@storage.host)
end
diff --git a/modules/storages/app/common/storages/adapters/providers/share_point/queries/internal/lists_query.rb b/modules/storages/app/common/storages/adapters/providers/share_point/queries/internal/lists_query.rb
index 9554d681d9d..d2072e6dcdc 100644
--- a/modules/storages/app/common/storages/adapters/providers/share_point/queries/internal/lists_query.rb
+++ b/modules/storages/app/common/storages/adapters/providers/share_point/queries/internal/lists_query.rb
@@ -83,8 +83,9 @@ module Storages
end
def request_uri
- storage_host = URI(@storage.host)
- URI.join(base_uri.origin, "/v1.0/sites/#{storage_host.host}:#{storage_host.path}:/lists").to_s
+ endpoint_uri = UrlBuilder.url(base_uri, "/v1.0/sites", host_uri.host)
+
+ "#{endpoint_uri}:#{site_path}:/lists"
end
def build_collection(files)