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

Use relative path when issuing HTTP requests.

Pavel Balashoue8ea5545ebc3
diff --git a/modules/storages/app/common/storages/peripherals/storage_interaction/nextcloud/add_user_to_group_command.rb b/modules/storages/app/common/storages/peripherals/storage_interaction/nextcloud/add_user_to_group_command.rb
index c396e4585c9..468bbf0605a 100644
--- a/modules/storages/app/common/storages/peripherals/storage_interaction/nextcloud/add_user_to_group_command.rb
+++ b/modules/storages/app/common/storages/peripherals/storage_interaction/nextcloud/add_user_to_group_command.rb
@@ -38,7 +38,7 @@ module Storages::Peripherals::StorageInteraction::Nextcloud
# rubocop:disable Metrics/AbcSize
def call(user:, group: @group)
response = Util.http(@uri).post(
- Util.join_uri_path(@uri, 'ocs/v1.php/cloud/users', CGI.escapeURIComponent(user), 'groups'),
+ Util.join_uri_path(@uri.path, 'ocs/v1.php/cloud/users', CGI.escapeURIComponent(user), 'groups'),
"groupid=#{CGI.escapeURIComponent(group)}",
Util
.basic_auth_header(@username, @password)
diff --git a/modules/storages/app/common/storages/peripherals/storage_interaction/nextcloud/copy_template_folder_command.rb b/modules/storages/app/common/storages/peripherals/storage_interaction/nextcloud/copy_template_folder_command.rb
index 5957746bbc3..3bbd8da297c 100644
--- a/modules/storages/app/common/storages/peripherals/storage_interaction/nextcloud/copy_template_folder_command.rb
+++ b/modules/storages/app/common/storages/peripherals/storage_interaction/nextcloud/copy_template_folder_command.rb
@@ -56,14 +56,14 @@ module Storages::Peripherals::StorageInteraction::Nextcloud
escaped_username = CGI.escapeURIComponent(@username)
source = Util.join_uri_path(
- @uri,
+ @uri.path,
"remote.php/dav/files",
escaped_username,
Util.escape_path(input[:source_path])
)
destination = Util.join_uri_path(
- @uri,
+ @uri.path,
"remote.php/dav/files",
escaped_username,
Util.escape_path(input[:destination_path])
diff --git a/modules/storages/app/common/storages/peripherals/storage_interaction/nextcloud/group_users_query.rb b/modules/storages/app/common/storages/peripherals/storage_interaction/nextcloud/group_users_query.rb
index 36fdea298cf..b42789c860e 100644
--- a/modules/storages/app/common/storages/peripherals/storage_interaction/nextcloud/group_users_query.rb
+++ b/modules/storages/app/common/storages/peripherals/storage_interaction/nextcloud/group_users_query.rb
@@ -40,7 +40,7 @@ module Storages::Peripherals::StorageInteraction::Nextcloud
# rubocop:disable Metrics/AbcSize
def call(group: @group)
response = Util.http(@uri).get(
- Util.join_uri_path(@uri, "ocs/v1.php/cloud/groups", CGI.escapeURIComponent(group)),
+ Util.join_uri_path(@uri.path, "ocs/v1.php/cloud/groups", CGI.escapeURIComponent(group)),
Util.basic_auth_header(@username, @password).merge('OCS-APIRequest' => 'true')
)
case response
diff --git a/modules/storages/app/common/storages/peripherals/storage_interaction/nextcloud/internal/propfind_query.rb b/modules/storages/app/common/storages/peripherals/storage_interaction/nextcloud/internal/propfind_query.rb
index cda875bdb81..1f2ae09863d 100644
--- a/modules/storages/app/common/storages/peripherals/storage_interaction/nextcloud/internal/propfind_query.rb
+++ b/modules/storages/app/common/storages/peripherals/storage_interaction/nextcloud/internal/propfind_query.rb
@@ -86,7 +86,7 @@ module Storages::Peripherals::StorageInteraction::Nextcloud::Internal
response = UTIL.http(@uri).propfind(
UTIL.join_uri_path(
- @uri,
+ @uri.path,
'remote.php/dav/files',
CGI.escapeURIComponent(@username),
UTIL.escape_path(path)
diff --git a/modules/storages/app/common/storages/peripherals/storage_interaction/nextcloud/remove_user_from_group_command.rb b/modules/storages/app/common/storages/peripherals/storage_interaction/nextcloud/remove_user_from_group_command.rb
index 619946c55a1..4e49848b869 100644
--- a/modules/storages/app/common/storages/peripherals/storage_interaction/nextcloud/remove_user_from_group_command.rb
+++ b/modules/storages/app/common/storages/peripherals/storage_interaction/nextcloud/remove_user_from_group_command.rb
@@ -38,7 +38,7 @@ module Storages::Peripherals::StorageInteraction::Nextcloud
# rubocop:disable Metrics/AbcSize
def call(user:, group: @group)
response = Util.http(@uri).delete(
- Util.join_uri_path(@uri,
+ Util.join_uri_path(@uri.path,
"ocs/v1.php/cloud/users",
CGI.escapeURIComponent(user),
"groups?groupid=#{CGI.escapeURIComponent(group)}"),