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
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
[#48441] Wrong bread crumbs in file picker
Eric Schubert0ceb74aa46a4
diff --git a/modules/storages/app/common/storages/peripherals/storage_interaction/nextcloud/files_query.rb b/modules/storages/app/common/storages/peripherals/storage_interaction/nextcloud/files_query.rbindex f42dde51d9b..4cf5a973ba3 100644--- a/modules/storages/app/common/storages/peripherals/storage_interaction/nextcloud/files_query.rb+++ b/modules/storages/app/common/storages/peripherals/storage_interaction/nextcloud/files_query.rb@@ -36,7 +36,7 @@ module Storages::Peripherals::StorageInteraction::Nextcloud# rubocop:disable Metrics/AbcSizedef call(user:, folder:)result = Util.token(user:, oauth_client: @oauth_client) do |token|- @base_path = Util.join_uri_path(@uri.path, "remote.php/dav/files", CGI.escapeURIComponent(token.origin_user_id))+ @base_path = Util.join_uri_path(@uri.path, "remote.php/dav/files", token.origin_user_id.gsub(' ', '%20'))response = Util.http(@uri).propfind(Util.join_uri_path(@base_path, requested_folder(folder)),@@ -61,6 +61,7 @@ module Storages::Peripherals::StorageInteraction::Nextcloudstorage_files(result)end+# rubocop:enable Metrics/AbcSizeprivatediff --git a/modules/storages/spec/common/peripherals/storage_requests_spec.rb b/modules/storages/spec/common/peripherals/storage_requests_spec.rbindex fafcc7f541e..be5e1d26f9a 100644--- a/modules/storages/spec/common/peripherals/storage_requests_spec.rb+++ b/modules/storages/spec/common/peripherals/storage_requests_spec.rb@@ -168,7 +168,8 @@ RSpec.describe Storages::Peripherals::StorageRequests, webmock: true dodescribe '#files_query' dolet(:parent) { '' }let(:root_path) { '' }- let(:xml) { create(:webdav_data, parent_path: parent, root_path:) }+ let(:origin_user_id) { 'darth@vader with spaces' }+ let(:xml) { create(:webdav_data, parent_path: parent, root_path:, origin_user_id:) }let(:url) { "https://example.com#{root_path}" }let(:request_url) doStorages::Peripherals::StorageInteraction::Nextcloud::Util.join_uri_path(@@ -191,26 +192,18 @@ RSpec.describe Storages::Peripherals::StorageRequests, webmock: true doexpect(result.result.files.size).to eq(4)expect(result.result.ancestors.size).to eq(0)expect(result.result.parent).not_to be_nil- expect(result.result.files[0]).to have_attributes(- id: '11',- name: 'Folder1',- mime_type: 'application/x-op-directory',- permissions: include(:readable, :writeable)- )- expect(result.result.files[1]).to have_attributes(- mime_type: 'application/x-op-directory',- permissions: %i[readable]- )- expect(result.result.files[2]).to have_attributes(- id: '12',- name: 'README.md',- mime_type: 'text/markdown',- permissions: include(:readable, :writeable)- )- expect(result.result.files[3]).to have_attributes(- mime_type: 'application/pdf',- permissions: %i[readable]- )+ expect(result.result.files[0]).to have_attributes(id: '11',+ name: 'Folder1',+ mime_type: 'application/x-op-directory',+ permissions: include(:readable, :writeable))+ expect(result.result.files[1]).to have_attributes(mime_type: 'application/x-op-directory',+ permissions: %i[readable])+ expect(result.result.files[2]).to have_attributes(id: '12',+ name: 'README.md',+ mime_type: 'text/markdown',+ permissions: include(:readable, :writeable))+ expect(result.result.files[3]).to have_attributes(mime_type: 'application/pdf',+ permissions: %i[readable])enddescribe 'with origin user id containing whitespaces' do@@ -354,11 +347,9 @@ RSpec.describe Storages::Peripherals::StorageRequests, webmock: true dobefore dostub_request(:get, "https://example.com/ocs/v1.php/apps/integration_openproject/fileinfo/#{file_id}")- .with(headers: {- 'Accept' => 'application/json',- 'Authorization' => 'Bearer xyz',- 'Content-Type' => 'application/json'- })+ .with(headers: { 'Accept' => 'application/json',+ 'Authorization' => 'Bearer xyz',+ 'Content-Type' => 'application/json' }).to_return(status: 200, body: expected_response_body, headers: {})end@@ -493,19 +484,19 @@ RSpec.describe Storages::Peripherals::StorageRequests, webmock: true dobefore dostub_request(:get, "https://example.com/ocs/v1.php/cloud/groups/#{storage.group}")- .with(- headers: {- 'Authorization' => 'Basic T3BlblByb2plY3Q6T3BlblByb2plY3RTZWN1cmVQYXNzd29yZA==',- 'OCS-APIRequest' => 'true'- }- )- .to_return(expected_response)+ .with(+ headers: {+ 'Authorization' => 'Basic T3BlblByb2plY3Q6T3BlblByb2plY3RTZWN1cmVQYXNzd29yZA==',+ 'OCS-APIRequest' => 'true'+ }+ )+ .to_return(expected_response)endit 'responds with a strings array with group users' doresult = subject- .group_users_query- .call+ .group_users_query+ .callexpect(result).to be_successexpect(result.result).to eq(["admin", "OpenProject", "reader", "TestUser", "TestUser34"])end@@ -537,13 +528,13 @@ RSpec.describe Storages::Peripherals::StorageRequests, webmock: true dobefore dostub_request(:post, "https://example.com/ocs/v1.php/cloud/users/#{origin_user_id}/groups")- .with(- headers: {- 'Authorization' => 'Basic T3BlblByb2plY3Q6T3BlblByb2plY3RTZWN1cmVQYXNzd29yZA==',- 'OCS-APIRequest' => 'true'- }- )- .to_return(expected_response)+ .with(+ headers: {+ 'Authorization' => 'Basic T3BlblByb2plY3Q6T3BlblByb2plY3RTZWN1cmVQYXNzd29yZA==',+ 'OCS-APIRequest' => 'true'+ }+ )+ .to_return(expected_response)endit 'adds user to the group' do@@ -581,13 +572,13 @@ RSpec.describe Storages::Peripherals::StorageRequests, webmock: true dobefore dostub_request(:delete, "https://example.com/ocs/v1.php/cloud/users/#{origin_user_id}/groups?groupid=#{storage.group}")- .with(- headers: {- 'Authorization' => 'Basic T3BlblByb2plY3Q6T3BlblByb2plY3RTZWN1cmVQYXNzd29yZA==',- 'OCS-APIRequest' => 'true'- }- )- .to_return(expected_response)+ .with(+ headers: {+ 'Authorization' => 'Basic T3BlblByb2plY3Q6T3BlblByb2plY3RTZWN1cmVQYXNzd29yZA==',+ 'OCS-APIRequest' => 'true'+ }+ )+ .to_return(expected_response)endit 'removes user from the group' do@@ -604,12 +595,12 @@ RSpec.describe Storages::Peripherals::StorageRequests, webmock: true dobefore dostub_request(:mkcol, "https://example.com/remote.php/dav/files/OpenProject/OpenProject/JediProject")- .with(- headers: {- 'Authorization' => 'Basic T3BlblByb2plY3Q6T3BlblByb2plY3RTZWN1cmVQYXNzd29yZA=='- }- )- .to_return(expected_response)+ .with(+ headers: {+ 'Authorization' => 'Basic T3BlblByb2plY3Q6T3BlblByb2plY3RTZWN1cmVQYXNzd29yZA=='+ }+ )+ .to_return(expected_response)endcontext 'when folder does not exist yet' do@@ -623,8 +614,8 @@ RSpec.describe Storages::Peripherals::StorageRequests, webmock: true doit 'creates a folder and responds with a success' doresult = subject- .create_folder_command- .call(folder_path:)+ .create_folder_command+ .call(folder_path:)expect(result).to be_successexpect(result.message).to eq("Folder was successfully created.")end@@ -650,8 +641,8 @@ RSpec.describe Storages::Peripherals::StorageRequests, webmock: true doit 'does not create a folder and responds with a success' doresult = subject- .create_folder_command- .call(folder_path:)+ .create_folder_command+ .call(folder_path:)expect(result).to be_successexpect(result.message).to eq("Folder already exists.")end@@ -677,8 +668,8 @@ RSpec.describe Storages::Peripherals::StorageRequests, webmock: true doit 'does not create a folder and responds with a failure' doresult = subject- .create_folder_command- .call(folder_path:)+ .create_folder_command+ .call(folder_path:)expect(result).to be_failureexpect(result.result).to eq(:conflict)expect(result.errors.log_message).to eq('Parent node does not exist')@@ -743,13 +734,13 @@ RSpec.describe Storages::Peripherals::StorageRequests, webmock: true docontext 'with outbound request' dobefore dostub_request(:proppatch, "#{url}/remote.php/dav/files/OpenProject/OpenProject/JediProject")- .with(- body: expected_request_body,- headers: {- 'Authorization' => 'Basic T3BlblByb2plY3Q6T3BlblByb2plY3RTZWN1cmVQYXNzd29yZA=='- }- )- .to_return(expected_response)+ .with(+ body: expected_request_body,+ headers: {+ 'Authorization' => 'Basic T3BlblByb2plY3Q6T3BlblByb2plY3RTZWN1cmVQYXNzd29yZA=='+ }+ )+ .to_return(expected_response)endcontext 'when permissions can be set' do@@ -783,8 +774,8 @@ RSpec.describe Storages::Peripherals::StorageRequests, webmock: true doit 'returns success when permissions can be set' doresult = subject- .set_permissions_command- .call(path:, permissions:)+ .set_permissions_command+ .call(path:, permissions:)expect(result).to be_successendend@@ -811,8 +802,8 @@ RSpec.describe Storages::Peripherals::StorageRequests, webmock: true doit 'returns failure' doresult = subject- .set_permissions_command- .call(path:, permissions:)+ .set_permissions_command+ .call(path:, permissions:)expect(result).to be_failureendend@@ -839,8 +830,8 @@ RSpec.describe Storages::Peripherals::StorageRequests, webmock: true doit 'returns failure' doresult = subject- .set_permissions_command- .call(path:, permissions:)+ .set_permissions_command+ .call(path:, permissions:)expect(result).to be_failureendend@@ -850,16 +841,16 @@ RSpec.describe Storages::Peripherals::StorageRequests, webmock: true doit 'raises an ArgumentError on nil' doexpect dosubject- .set_permissions_command- .call(path: nil, permissions:)+ .set_permissions_command+ .call(path: nil, permissions:)end.to raise_error(ArgumentError)endit 'raises an ArgumentError on empty string' doexpect dosubject- .set_permissions_command- .call(path: '', permissions:)+ .set_permissions_command+ .call(path: '', permissions:)end.to raise_error(ArgumentError)endend@@ -938,7 +929,6 @@ RSpec.describe Storages::Peripherals::StorageRequests, webmock: true do</d:prop><d:status>HTTP/1.1 200 OK</d:status></d:propstat>- <d:propstat></d:response><d:response><d:href>/remote.php/dav/files/OpenProject/OpenProject/qweekk/</d:href>@@ -974,7 +964,8 @@ RSpec.describe Storages::Peripherals::StorageRequests, webmock: true do"OpenProject/Project#1/" => { "fileid" => "773" },"OpenProject/Project#2/" => { "fileid" => "398" },"OpenProject/asd/" => { "fileid" => "783" },- "OpenProject/qwe/" => { "fileid" => "767" } })+ "OpenProject/qwe/" => { "fileid" => "767" },+ "OpenProject/qweekk/" => { "fileid" => "802" } })endendend@@ -982,19 +973,19 @@ RSpec.describe Storages::Peripherals::StorageRequests, webmock: true dodescribe '#rename_file_command' dobefore dostub_request(:move, "https://example.com/remote.php/dav/files/OpenProject/OpenProject/asd")- .with(- headers: {- 'Authorization' => 'Basic T3BlblByb2plY3Q6T3BlblByb2plY3RTZWN1cmVQYXNzd29yZA==',- 'Destination' => '/remote.php/dav/files/OpenProject/OpenProject/qwe'- }- ).to_return(status: 201, body: '', headers: {})+ .with(+ headers: {+ 'Authorization' => 'Basic T3BlblByb2plY3Q6T3BlblByb2plY3RTZWN1cmVQYXNzd29yZA==',+ 'Destination' => '/remote.php/dav/files/OpenProject/OpenProject/qwe'+ }+ ).to_return(status: 201, body: '', headers: {})enddescribe 'with Nextcloud storage type selected' doit 'moves the file' doresult = subject- .rename_file_command- .call(source: 'OpenProject/asd', target: 'OpenProject/qwe')+ .rename_file_command+ .call(source: 'OpenProject/asd', target: 'OpenProject/qwe')expect(result).to be_successendend