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

[#49630] Nextcloud/Administration link is stripped when host has a subpath (#13477)

Kabiru Mwenja2012cc402f0e
diff --git a/modules/storages/app/views/storages/admin/storages/automatically_managed_project_folders/edit.html.erb b/modules/storages/app/views/storages/admin/storages/automatically_managed_project_folders/edit.html.erb
index 66f5765df3f..29f8232a2b7 100644
--- a/modules/storages/app/views/storages/admin/storages/automatically_managed_project_folders/edit.html.erb
+++ b/modules/storages/app/views/storages/admin/storages/automatically_managed_project_folders/edit.html.erb
@@ -80,7 +80,8 @@ See COPYRIGHT and LICENSE files for more details.
<p class="form--field-instructions -xwide">
<%= t(:"storages.instructions.managed_project_folders_application_password") %>
<a
- href="<%= URI.join(@storage.oauth_application.integration.host, 'settings/admin/openproject') %>"
+ href="<%= Storages::Peripherals::StorageInteraction::Nextcloud::Util
+ .join_uri_path(@storage.oauth_application.integration.host, 'settings/admin/openproject') %>"
target="_blank"
class="spot-link"
>
diff --git a/modules/storages/spec/features/admin_storages_spec.rb b/modules/storages/spec/features/admin_storages_spec.rb
index 8b80e566417..c41238f4ccd 100644
--- a/modules/storages/spec/features/admin_storages_spec.rb
+++ b/modules/storages/spec/features/admin_storages_spec.rb
@@ -212,6 +212,17 @@ RSpec.describe 'Admin storages', :storage_server_helpers, js: true do
expect(page).to have_text(created_storage.created_at.localtime.strftime("%m/%d/%Y %I:%M %p"))
######### Begin Edit Automatically managed project folders #########
+ page.find('.button--icon.icon-edit').click
+
+ # Confirm update of host URL with subpath renders correctly Nextcloud/Administration link
+ mock_server_capabilities_response("https://example.com/with/subpath")
+ mock_server_config_check_response("https://example.com/with/subpath")
+ page.find_by_id('storages_storage_host').set("https://example.com/with/subpath")
+ page.click_button('Save')
+
+ # Check for updated host URL
+ expect(page).to have_text("https://example.com/with/subpath")
+
page.find('.button--icon.icon-edit').click
page.find('a', text: 'Edit automatically managed project folders').click
@@ -221,6 +232,7 @@ RSpec.describe 'Admin storages', :storage_server_helpers, js: true do
expect(automatically_managed_switch).to be_checked
expect(application_password_input.value).to be_empty
expect(application_password_input['placeholder']).to eq("●●●●●●●●●●●●●●●●")
+ expect(page).to have_link(text: 'Nextcloud Administration / OpenProject', href: 'https://example.com/with/subpath/settings/admin/openproject')
# Clicking submit without inputing new application password should show an error
page.click_button('Save')