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

[#47152] Fix direct uploads when Nextcloud configured without pretty URLs

Wieland Lindenthalc51fafbd2681
diff --git a/modules/storages/app/common/storages/peripherals/storage_interaction/nextcloud/upload_link_query.rb b/modules/storages/app/common/storages/peripherals/storage_interaction/nextcloud/upload_link_query.rb
index 3e1f0cdfccd..9fd9bff68a7 100644
--- a/modules/storages/app/common/storages/peripherals/storage_interaction/nextcloud/upload_link_query.rb
+++ b/modules/storages/app/common/storages/peripherals/storage_interaction/nextcloud/upload_link_query.rb
@@ -30,8 +30,8 @@ module Storages::Peripherals::StorageInteraction::Nextcloud
class UploadLinkQuery < Storages::Peripherals::StorageInteraction::StorageQuery
using Storages::Peripherals::ServiceResultRefinements # use '>>' (bind) operator for ServiceResult
- URI_TOKEN_REQUEST = 'apps/integration_openproject/direct-upload-token'.freeze
- URI_UPLOAD_BASE_PATH = 'apps/integration_openproject/direct-upload'.freeze
+ URI_TOKEN_REQUEST = 'index.php/apps/integration_openproject/direct-upload-token'.freeze
+ URI_UPLOAD_BASE_PATH = 'index.php/apps/integration_openproject/direct-upload'.freeze
def initialize(base_uri:, token:, retry_proc:)
super()
diff --git a/modules/storages/spec/common/peripherals/storage_requests_spec.rb b/modules/storages/spec/common/peripherals/storage_requests_spec.rb
index 71024a547ad..f086bb3e34d 100644
--- a/modules/storages/spec/common/peripherals/storage_requests_spec.rb
+++ b/modules/storages/spec/common/peripherals/storage_requests_spec.rb
@@ -420,7 +420,7 @@ describe Storages::Peripherals::StorageRequests, webmock: true do
before do
allow(OAuthClients::ConnectionManager).to receive(:new).and_return(connection_manager)
- stub_request(:post, "#{url}/apps/integration_openproject/direct-upload-token")
+ stub_request(:post, "#{url}/index.php/apps/integration_openproject/direct-upload-token")
.with(body: { folder_id: query_payload.parent })
.to_return(
status: 200,
@@ -439,7 +439,7 @@ describe Storages::Peripherals::StorageRequests, webmock: true do
on_success: ->(query) do
query.call(query_payload).match(
on_success: ->(link) {
- expect(link.destination.path).to be_eql("/apps/integration_openproject/direct-upload/#{upload_token}")
+ expect(link.destination.path).to be_eql("/index.php/apps/integration_openproject/direct-upload/#{upload_token}")
expect(link.destination.host).to be_eql(URI(url).host)
expect(link.destination.scheme).to be_eql(URI(url).scheme)
expect(link.destination.user).to be_nil
@@ -481,7 +481,7 @@ describe Storages::Peripherals::StorageRequests, webmock: true do
shared_examples_for 'outbound is failing' do |code, symbol|
describe "with outbound request returning #{code}" do
before do
- stub_request(:post, "#{url}/apps/integration_openproject/direct-upload-token").to_return(status: code)
+ stub_request(:post, "#{url}/index.php/apps/integration_openproject/direct-upload-token").to_return(status: code)
end
it "must return :#{symbol} ServiceResult" do