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

[#56997] files query for nextcloud returns bad location data (#16386)

Eric Schubert0284a862a4d2
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.rb
index 10d83ba3259..3b1524a0083 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
@@ -42,16 +42,13 @@ module Storages
end
def call(auth_strategy:, folder:)
- if auth_strategy.user.nil?
- error_data = StorageErrorData.new(source: self)
- return Util.error(:error, "Cannot execute query without user context.", error_data)
- end
+ validate_input_data(auth_strategy, folder).on_failure { return _1 }
origin_user = Util.origin_user_id(caller: self.class, storage: @storage, auth_strategy:)
.on_failure { return _1 }
.result
- @location_prefix = UrlBuilder.path(@storage.uri.path, "remote.php/dav/files", origin_user)
+ @location_prefix = CGI.unescape UrlBuilder.path(@storage.uri.path, "remote.php/dav/files", origin_user)
result = make_request(auth_strategy:, folder:, origin_user:)
storage_files(result)
@@ -59,6 +56,18 @@ module Storages
private
+ def validate_input_data(auth_strategy, folder)
+ error_data = StorageErrorData.new(source: self.class)
+
+ if auth_strategy.user.nil?
+ Util.error(:error, "Cannot execute query without user context.", error_data)
+ elsif folder.is_a?(ParentFolder)
+ ServiceResult.success
+ else
+ Util.error(:error, "Folder input is not a ParentFolder object.", error_data)
+ end
+ end
+
def make_request(auth_strategy:, folder:, origin_user:)
Authentication[auth_strategy].call(storage: @storage,
http_options: Util.webdav_request_with_depth(1)) do |http|
diff --git a/modules/storages/app/common/storages/peripherals/storage_interaction/one_drive/files_query.rb b/modules/storages/app/common/storages/peripherals/storage_interaction/one_drive/files_query.rb
index 5df1da39d6e..e67b75223e4 100644
--- a/modules/storages/app/common/storages/peripherals/storage_interaction/one_drive/files_query.rb
+++ b/modules/storages/app/common/storages/peripherals/storage_interaction/one_drive/files_query.rb
@@ -48,6 +48,8 @@ module Storages
def call(auth_strategy:, folder:)
with_tagged_logger do
info "Getting data on all files under folder '#{folder}' using #{auth_strategy.key}"
+ validate_input_data(folder).on_failure { return _1 }
+
Authentication[auth_strategy].call(storage: @storage) do |http|
response = handle_response(http.get(children_url_for(folder) + FIELDS), :value)
@@ -62,6 +64,16 @@ module Storages
private
+ def validate_input_data(folder)
+ if folder.is_a?(ParentFolder)
+ ServiceResult.success
+ else
+ data = StorageErrorData.new(source: self.class)
+ log_message = "Folder input is not a ParentFolder object."
+ ServiceResult.failure(result: :error, errors: StorageError.new(code: :error, log_message:, data:))
+ end
+ end
+
# rubocop:disable Metrics/AbcSize
def handle_response(response, map_value)
case response
@@ -106,7 +118,7 @@ module Storages
StorageFile.new(
id: parent_id,
name: path.split("/").last,
- location: path,
+ location: UrlBuilder.path(path),
permissions: %i[readable writeable]
),
forge_ancestors(path:)
@@ -122,7 +134,7 @@ module Storages
StorageFile.new(
id: parent_reference[:id],
name:,
- location: Util.extract_location(parent_reference),
+ location: UrlBuilder.path(Util.extract_location(parent_reference)),
permissions: %i[readable writeable]
)
end
@@ -137,7 +149,7 @@ module Storages
StorageFile.new(
id: Digest::SHA256.hexdigest(component),
name: component,
- location: "/#{component}"
+ location: UrlBuilder.path(component)
)
end
end
diff --git a/modules/storages/app/helpers/storages/url_builder.rb b/modules/storages/app/helpers/storages/url_builder.rb
index f4ff421918e..49d1a98351a 100644
--- a/modules/storages/app/helpers/storages/url_builder.rb
+++ b/modules/storages/app/helpers/storages/url_builder.rb
@@ -39,7 +39,7 @@ module Storages
end
def path(*path_fragments)
- URI.join(URI("https://drop.me"), *split_and_escape(path_fragments)).path
+ URI.join(URI("https://drop.me/"), *split_and_escape(path_fragments)).path
end
private
@@ -58,6 +58,8 @@ module Storages
.each { |f| ensure_unescaped_fragments(f) }
.map { |f| CGI.escapeURIComponent(f) }
+ return [] if single_fragments.empty?
+
single_fragments[..-2]
.map { |f| "#{f}/" }
.push(single_fragments.last)
diff --git a/modules/storages/app/models/storages/storage_files.rb b/modules/storages/app/models/storages/storage_files.rb
index 49f48e654b2..74846a2dc6c 100644
--- a/modules/storages/app/models/storages/storage_files.rb
+++ b/modules/storages/app/models/storages/storage_files.rb
@@ -29,13 +29,5 @@
#++
module Storages
- class StorageFiles
- attr_reader :files, :parent, :ancestors
-
- def initialize(files, parent, ancestors)
- @files = files.freeze
- @parent = parent.freeze
- @ancestors = ancestors.freeze
- end
- end
+ StorageFiles = Data.define(:files, :parent, :ancestors)
end
diff --git a/modules/storages/spec/common/storages/peripherals/storage_interaction/nextcloud/files_query_spec.rb b/modules/storages/spec/common/storages/peripherals/storage_interaction/nextcloud/files_query_spec.rb
index 427180aba28..56ba2f4c394 100644
--- a/modules/storages/spec/common/storages/peripherals/storage_interaction/nextcloud/files_query_spec.rb
+++ b/modules/storages/spec/common/storages/peripherals/storage_interaction/nextcloud/files_query_spec.rb
@@ -32,178 +32,215 @@ require "spec_helper"
require_module_spec_helper
RSpec.describe Storages::Peripherals::StorageInteraction::Nextcloud::FilesQuery, :vcr, :webmock do
- using Storages::Peripherals::ServiceResultRefinements
-
let(:user) { create(:user) }
let(:storage) do
- create(:nextcloud_storage_with_local_connection, :as_not_automatically_managed, oauth_client_token_user: user)
+ create(:nextcloud_storage_with_local_connection,
+ :as_not_automatically_managed,
+ oauth_client_token_user: user,
+ origin_user_id: "[email protected]")
end
- let(:folder) { Storages::Peripherals::ParentFolder.new("/") }
let(:auth_strategy) do
Storages::Peripherals::StorageInteraction::AuthenticationStrategies::OAuthUserToken.strategy.with_user(user)
end
- describe "#call" do
- it "responds with correct parameters" do
- expect(described_class).to respond_to(:call)
-
- method = described_class.method(:call)
- expect(method.parameters).to contain_exactly(%i[keyreq storage],
- %i[keyreq auth_strategy],
- %i[keyreq folder])
+ it_behaves_like "files_query: basic query setup"
+
+ it_behaves_like "files_query: validating input data"
+
+ context "with parent folder being root", vcr: "nextcloud/files_query_root" do
+ let(:folder) { Storages::Peripherals::ParentFolder.new("/") }
+ let(:files_result) do
+ # FIXME: nextcloud files query currently does not correctly returns modifier and creation date.
+ Storages::StorageFiles.new(
+ [
+ Storages::StorageFile.new(id: "555",
+ name: "Folder",
+ size: 232167,
+ mime_type: "application/x-op-directory",
+ created_at: nil,
+ last_modified_at: Time.zone.parse("2024-08-09T11:53:42Z"),
+ created_by_name: "Mara Jade",
+ last_modified_by_name: nil,
+ location: "/Folder",
+ permissions: %i[readable writeable]),
+ Storages::StorageFile.new(id: "561",
+ name: "Folder with spaces",
+ size: 890,
+ mime_type: "application/x-op-directory",
+ created_at: nil,
+ last_modified_at: Time.zone.parse("2024-08-09T11:52:09Z"),
+ created_by_name: "Mara Jade",
+ last_modified_by_name: nil,
+ location: "/Folder%20with%20spaces",
+ permissions: %i[readable writeable]),
+ Storages::StorageFile.new(id: "562",
+ name: "Ümlæûts",
+ size: 19720,
+ mime_type: "application/x-op-directory",
+ created_at: nil,
+ last_modified_at: Time.zone.parse("2024-08-09T11:51:48Z"),
+ created_by_name: "Mara Jade",
+ last_modified_by_name: nil,
+ location: "/%c3%9cml%c3%a6%c3%bbts",
+ permissions: %i[readable writeable])
+ ],
+ Storages::StorageFile.new(id: "385",
+ name: "Root",
+ size: 252777,
+ mime_type: "application/x-op-directory",
+ created_at: nil,
+ last_modified_at: Time.zone.parse("2024-08-09T11:53:42Z"),
+ created_by_name: "Mara Jade",
+ last_modified_by_name: nil,
+ location: "/",
+ permissions: %i[readable writeable]),
+ []
+ )
end
- context "with outbound requests successful" do
- context "with parent folder being root", vcr: "nextcloud/files_query_root" do
- # rubocop:disable RSpec/ExampleLength
- it "returns a StorageFiles object for root" do
- storage_files = described_class.call(storage:, auth_strategy:, folder:).result
-
- expect(storage_files).to be_a(Storages::StorageFiles)
- expect(storage_files.ancestors).to be_empty
- expect(storage_files.parent.name).to eq("Root")
-
- expect(storage_files.files.size).to eq(4)
- expect(storage_files.files.map(&:to_h))
- .to eq([
- {
- id: "172",
- name: "Folder",
- size: 982713473,
- created_at: nil,
- created_by_name: "admin",
- last_modified_at: "2023-11-29T15:31:30Z",
- last_modified_by_name: nil,
- location: "/Folder",
- mime_type: "application/x-op-directory",
- permissions: %i[readable writeable]
- }, {
- id: "173",
- name: "Folder with spaces",
- size: 74,
- created_at: nil,
- created_by_name: "admin",
- last_modified_at: "2023-11-29T15:42:21Z",
- last_modified_by_name: nil,
- location: "/Folder%20with%20spaces",
- mime_type: "application/x-op-directory",
- permissions: %i[readable writeable]
- }, {
- id: "211",
- name: "Practical_guide_to_BAGGM_Digital.pdf",
- size: 154592937,
- created_at: nil,
- created_by_name: "admin",
- last_modified_at: "2022-08-09T06:53:12Z",
- last_modified_by_name: nil,
- location: "/Practical_guide_to_BAGGM_Digital.pdf",
- mime_type: "application/pdf",
- permissions: %i[readable writeable]
- }, {
- id: "178",
- name: "Readme.md",
- size: 31,
- created_at: nil,
- created_by_name: "admin",
- last_modified_at: "2023-11-29T15:29:16Z",
- last_modified_by_name: nil,
- location: "/Readme.md",
- mime_type: "text/markdown",
- permissions: %i[readable writeable]
- }
- ])
- end
- # rubocop:enable RSpec/ExampleLength
- end
-
- context "with a given parent folder", vcr: "nextcloud/files_query_parent_folder" do
- let(:folder) { Storages::Peripherals::ParentFolder.new("/Folder with spaces/New Requests") }
-
- subject do
- described_class.call(storage:, auth_strategy:, folder:).result
- end
-
- # rubocop:disable RSpec/ExampleLength
- it "returns the files content" do
- expect(subject.files.size).to eq(2)
- expect(subject.files.map(&:to_h))
- .to eq([
- {
- id: "181",
- name: "request_001.md",
- size: 48,
- created_at: nil,
- created_by_name: "admin",
- last_modified_at: "2023-11-29T15:35:25Z",
- last_modified_by_name: nil,
- location: "/Folder%20with%20spaces/New%20Requests/request_001.md",
- mime_type: "text/markdown",
- permissions: %i[readable writeable]
- }, {
- id: "182",
- name: "request_002.md",
- size: 26,
- created_at: nil,
- created_by_name: "admin",
- last_modified_at: "2023-11-29T15:35:34Z",
- last_modified_by_name: nil,
- location: "/Folder%20with%20spaces/New%20Requests/request_002.md",
- mime_type: "text/markdown",
- permissions: %i[readable writeable]
- }
- ])
- end
- # rubocop:enable RSpec/ExampleLength
+ it_behaves_like "files_query: successful files response"
+ end
- it "returns ancestors with a forged id" do
- expect(subject.ancestors.map { |a| { id: a.id, name: a.name, location: a.location } })
- .to eq([
- {
- id: "8a5edab282632443219e051e4ade2d1d5bbc671c781051bf1437897cbdfea0f1",
- name: "Root",
- location: "/"
- }, {
- id: "c8776f1f6dd36c023c6615d39f01a71d68dd1707b232115b7a4f58bc6da94e2e",
- name: "Folder with spaces",
- location: "/Folder%20with%20spaces"
- }
- ])
- end
+ context "with a given parent folder", vcr: "nextcloud/files_query_parent_folder" do
+ let(:folder) { Storages::Peripherals::ParentFolder.new("/Folder/Nested Folder") }
+ let(:files_result) do
+ Storages::StorageFiles.new(
+ [
+ Storages::StorageFile.new(id: "603",
+ name: "giphy.gif",
+ size: 184726,
+ mime_type: "image/gif",
+ created_at: nil,
+ last_modified_at: Time.zone.parse("2024-08-09T11:53:24Z"),
+ created_by_name: "Mara Jade",
+ last_modified_by_name: nil,
+ location: "/Folder/Nested%20Folder/giphy.gif",
+ permissions: %i[readable writeable]),
+ Storages::StorageFile.new(id: "604",
+ name: "release_meme.jpg",
+ size: 46264,
+ mime_type: "image/jpeg",
+ created_at: nil,
+ last_modified_at: Time.zone.parse("2024-08-09T11:53:30Z"),
+ created_by_name: "Mara Jade",
+ last_modified_by_name: nil,
+ location: "/Folder/Nested%20Folder/release_meme.jpg",
+ permissions: %i[readable writeable]),
+ Storages::StorageFile.new(id: "602",
+ name: "todo.txt",
+ size: 55,
+ mime_type: "text/plain",
+ created_at: nil,
+ last_modified_at: Time.zone.parse("2024-08-09T11:53:35Z"),
+ created_by_name: "Mara Jade",
+ last_modified_by_name: nil,
+ location: "/Folder/Nested%20Folder/todo.txt",
+ permissions: %i[readable writeable])
+ ],
+ Storages::StorageFile.new(id: "601",
+ name: "Nested Folder",
+ size: 231045,
+ mime_type: "application/x-op-directory",
+ created_at: nil,
+ last_modified_at: Time.zone.parse("2024-08-09T11:53:42Z"),
+ created_by_name: "Mara Jade",
+ last_modified_by_name: nil,
+ location: "/Folder/Nested%20Folder",
+ permissions: %i[readable writeable]),
+ [
+ Storages::StorageFile.new(id: "8a5edab282632443219e051e4ade2d1d5bbc671c781051bf1437897cbdfea0f1",
+ name: "Root",
+ location: "/"),
+ Storages::StorageFile.new(id: "0da2f1cf70005eaeb08333802726c2928503d975e4a70cbdd1a28313cded20ae",
+ name: "Folder",
+ location: "/Folder")
+ ]
+ )
+ end
- it "returns the parent itself" do
- expect(subject.parent.id).to eq("180")
- expect(subject.parent.name).to eq("New Requests")
- expect(subject.parent.location).to eq("/Folder%20with%20spaces/New%20Requests")
- end
- end
+ it_behaves_like "files_query: successful files response"
+ end
- context "with parent folder being empty", vcr: "nextcloud/files_query_empty_folder" do
- let(:folder) { Storages::Peripherals::ParentFolder.new("/Folder/empty") }
+ context "with parent folder being empty", vcr: "nextcloud/files_query_empty_folder" do
+ let(:folder) { Storages::Peripherals::ParentFolder.new("/Folder with spaces/very empty folder") }
+ let(:files_result) do
+ Storages::StorageFiles.new(
+ [],
+ Storages::StorageFile.new(id: "571",
+ name: "very empty folder",
+ size: 0,
+ mime_type: "application/x-op-directory",
+ created_at: nil,
+ last_modified_at: Time.zone.parse("2024-08-09T11:52:04Z"),
+ created_by_name: "Mara Jade",
+ last_modified_by_name: nil,
+ location: "/Folder%20with%20spaces/very%20empty%20folder",
+ permissions: %i[readable writeable]),
+ [
+ Storages::StorageFile.new(id: "8a5edab282632443219e051e4ade2d1d5bbc671c781051bf1437897cbdfea0f1",
+ name: "Root",
+ location: "/"),
+ Storages::StorageFile.new(id: "c8776f1f6dd36c023c6615d39f01a71d68dd1707b232115b7a4f58bc6da94e2e",
+ name: "Folder with spaces",
+ location: "/Folder%20with%20spaces")
+ ]
+ )
+ end
- it "returns an empty StorageFiles object with parent and ancestors" do
- storage_files = described_class.call(storage:, auth_strategy:, folder:).result
+ it_behaves_like "files_query: successful files response"
+ end
- expect(storage_files).to be_a(Storages::StorageFiles)
- expect(storage_files.files).to be_empty
- expect(storage_files.parent.id).to eq("174")
- expect(storage_files.ancestors.map(&:name)).to eq(%w[Root Folder])
- end
- end
+ context "with a path full of umlauts", vcr: "nextcloud/files_query_umlauts" do
+ let(:folder) { Storages::Peripherals::ParentFolder.new("/Ümlæûts") }
+ let(:files_result) do
+ Storages::StorageFiles.new(
+ [
+ Storages::StorageFile.new(id: "564",
+ name: "Anrüchiges deutsches Dokument.docx",
+ size: 19720,
+ mime_type: "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
+ created_at: nil,
+ last_modified_at: Time.zone.parse("2024-08-09T11:51:40Z"),
+ created_by_name: "Mara Jade",
+ last_modified_by_name: nil,
+ location: "/%c3%9cml%c3%a6%c3%bbts/Anr%c3%bcchiges%20deutsches%20Dokument.docx",
+ permissions: %i[readable writeable]),
+ Storages::StorageFile.new(id: "563",
+ name: "data",
+ size: 0,
+ mime_type: "application/x-op-directory",
+ created_at: nil,
+ last_modified_at: Time.zone.parse("2024-08-09T11:51:30Z"),
+ created_by_name: "Mara Jade",
+ last_modified_by_name: nil,
+ location: "/%c3%9cml%c3%a6%c3%bbts/data",
+ permissions: %i[readable writeable])
+ ],
+ Storages::StorageFile.new(id: "562",
+ name: "Ümlæûts",
+ size: 19720,
+ mime_type: "application/x-op-directory",
+ created_at: nil,
+ last_modified_at: Time.zone.parse("2024-08-09T11:51:48Z"),
+ created_by_name: "Mara Jade",
+ last_modified_by_name: nil,
+ location: "/%c3%9cml%c3%a6%c3%bbts",
+ permissions: %i[readable writeable]),
+ [
+ Storages::StorageFile.new(id: "8a5edab282632443219e051e4ade2d1d5bbc671c781051bf1437897cbdfea0f1",
+ name: "Root",
+ location: "/")
+ ]
+ )
end
- context "with not existent parent folder", vcr: "nextcloud/files_query_invalid_parent" do
- let(:folder) { Storages::Peripherals::ParentFolder.new("/I/just/made/that/up") }
+ it_behaves_like "files_query: successful files response"
+ end
- it "must return not found" do
- result = described_class.call(storage:, auth_strategy:, folder:)
- expect(result).to be_failure
- expect(result.error_source).to be(described_class)
+ context "with not existent parent folder", vcr: "nextcloud/files_query_invalid_parent" do
+ let(:folder) { Storages::Peripherals::ParentFolder.new("/I/just/made/that/up") }
+ let(:error_source) { described_class }
- result.match(
- on_failure: ->(error) { expect(error.code).to eq(:not_found) },
- on_success: ->(file_infos) { fail "Expected failure, got #{file_infos}" }
- )
- end
- end
+ it_behaves_like "files_query: not found"
end
end
diff --git a/modules/storages/spec/common/storages/peripherals/storage_interaction/one_drive/files_query_spec.rb b/modules/storages/spec/common/storages/peripherals/storage_interaction/one_drive/files_query_spec.rb
index a55b844dbff..941b1c3f26e 100644
--- a/modules/storages/spec/common/storages/peripherals/storage_interaction/one_drive/files_query_spec.rb
+++ b/modules/storages/spec/common/storages/peripherals/storage_interaction/one_drive/files_query_spec.rb
@@ -32,162 +32,171 @@ require "spec_helper"
require_module_spec_helper
RSpec.describe Storages::Peripherals::StorageInteraction::OneDrive::FilesQuery, :webmock do
- using Storages::Peripherals::ServiceResultRefinements
-
let(:user) { create(:user) }
let(:storage) { create(:sharepoint_dev_drive_storage, oauth_client_token_user: user) }
- let(:folder) { Storages::Peripherals::ParentFolder.new("/") }
let(:auth_strategy) do
Storages::Peripherals::StorageInteraction::AuthenticationStrategies::OAuthUserToken.strategy.with_user(user)
end
- describe "#call" do
- it "responds with correct parameters" do
- expect(described_class).to respond_to(:call)
-
- method = described_class.method(:call)
- expect(method.parameters).to contain_exactly(%i[keyreq storage], %i[keyreq auth_strategy], %i[keyreq folder])
+ it_behaves_like "files_query: basic query setup"
+
+ it_behaves_like "files_query: validating input data"
+
+ context "with parent folder being root", vcr: "one_drive/files_query_root" do
+ let(:folder) { Storages::Peripherals::ParentFolder.new("/") }
+ let(:files_result) do
+ Storages::StorageFiles.new(
+ [
+ Storages::StorageFile.new(id: "01AZJL5PMAXGDWAAKMEBALX4Q6GSN5BSBR",
+ name: "Folder",
+ size: 260500,
+ mime_type: "application/x-op-directory",
+ created_at: Time.zone.parse("2023-09-26T14:38:50Z"),
+ last_modified_at: Time.zone.parse("2023-09-26T14:38:50Z"),
+ created_by_name: "Eric Schubert",
+ last_modified_by_name: "Eric Schubert",
+ location: "/Folder",
+ permissions: %i[readable writeable]),
+ Storages::StorageFile.new(id: "01AZJL5PKU2WV3U3RKKFF2A7ZCWVBXRTEU",
+ name: "Folder with spaces",
+ size: 35141,
+ mime_type: "application/x-op-directory",
+ created_at: Time.zone.parse("2023-09-26T14:38:57Z"),
+ last_modified_at: Time.zone.parse("2023-09-26T14:38:57Z"),
+ created_by_name: "Eric Schubert",
+ last_modified_by_name: "Eric Schubert",
+ location: "/Folder%20with%20spaces",
+ permissions: %i[readable writeable]),
+ Storages::StorageFile.new(id: "01AZJL5PN3LVLHH2RSZZDJ6ZFAD3OWSGYB",
+ name: "Permissions Folder",
+ size: 0,
+ mime_type: "application/x-op-directory",
+ created_at: Time.zone.parse("2024-01-12T09:05:10Z"),
+ last_modified_at: Time.zone.parse("2024-01-12T09:05:24Z"),
+ created_by_name: "Marcello Rocha",
+ last_modified_by_name: "Marcello Rocha",
+ location: "/Permissions%20Folder",
+ permissions: %i[readable writeable])
+ ],
+ Storages::StorageFile.new(id: "01AZJL5PN6Y2GOVW7725BZO354PWSELRRZ",
+ name: "Root",
+ location: "/",
+ permissions: %i[readable writeable]),
+ []
+ )
end
- context "with outbound requests successful" do
- context "with parent folder being root", vcr: "one_drive/files_query_root" do
- it "returns a StorageFiles object for root" do
- storage_files = described_class.call(storage:, auth_strategy:, folder:).result
-
- expect(storage_files).to be_a(Storages::StorageFiles)
- expect(storage_files.ancestors).to be_empty
- expect(storage_files.parent.name).to eq("Root")
- expect(storage_files.files.count).to eq(3)
- expect(storage_files.files.map(&:to_h).first)
- .to eq({ id: "01AZJL5PMAXGDWAAKMEBALX4Q6GSN5BSBR",
- name: "Folder",
- size: 260500,
- created_at: Time.zone.parse("2023-09-26T14:38:50Z"),
- created_by_name: "Eric Schubert",
- last_modified_at: Time.zone.parse("2023-09-26T14:38:50Z"),
- last_modified_by_name: "Eric Schubert",
- location: "/Folder",
- mime_type: "application/x-op-directory",
- permissions: %i[readable writeable] })
- end
- end
-
- context "with a given parent folder", vcr: "one_drive/files_query_parent_folder" do
- let(:folder) { Storages::Peripherals::ParentFolder.new("/Folder/Subfolder") }
-
- subject do
- described_class.call(storage:, auth_strategy:, folder:).result
- end
-
- # rubocop:disable RSpec/ExampleLength
- it "returns the files content" do
- expect(subject.files.map(&:to_h))
- .to eq([
- {
- id: "01AZJL5PNCQCEBFI3N7JGZSX5AOX32Z3LA",
- name: "NextcloudHub.md",
- size: 1095,
- created_at: "2023-09-26T14:45:25Z",
- created_by_name: "Eric Schubert",
- last_modified_at: "2023-09-26T14:46:13Z",
- last_modified_by_name: "Eric Schubert",
- location: "/Folder/Subfolder/NextcloudHub.md",
- mime_type: "application/octet-stream",
- permissions: %i[readable writeable]
- }, {
- id: "01AZJL5PLOL2KZTJNVFBCJWFXYGYVBQVMZ",
- name: "test.txt",
- size: 28,
- created_at: "2023-09-26T14:45:23Z",
- created_by_name: "Eric Schubert",
- last_modified_at: "2023-09-26T14:45:45Z",
- last_modified_by_name: "Eric Schubert",
- location: "/Folder/Subfolder/test.txt",
- mime_type: "text/plain",
- permissions: %i[readable writeable]
- }
- ])
- end
- # rubocop:enable RSpec/ExampleLength
-
- it "returns ancestors with a forged id" do
- expect(subject.ancestors.map { |a| { id: a.id, name: a.name, location: a.location } })
- .to eq([
- {
- id: "a1d45ff742d2175c095f0a7173f93fc3fc23664a953ceae6778fe15398818c2d",
- name: "Root",
- location: "/"
- }, {
- id: "74ccd43303847f2655300641a934959cdb11689ce171aa0f00faa92917fbd340",
- name: "Folder",
- location: "/Folder"
- }
- ])
- end
-
- it "returns the parent itself" do
- expect(subject.parent.id).to eq("01AZJL5PPWP5UOATNRJJBYJG5TACDHEUAG")
- expect(subject.parent.name).to eq("Subfolder")
- expect(subject.parent.location).to eq("/Folder/Subfolder")
- end
- end
-
- context "with parent folder being empty", vcr: "one_drive/files_query_empty_folder" do
- let(:folder) { Storages::Peripherals::ParentFolder.new("/Folder with spaces/very empty folder") }
-
- it "returns an empty StorageFiles object with parent and ancestors" do
- storage_files = described_class.call(storage:, auth_strategy:, folder:).result
+ it_behaves_like "files_query: successful files response"
+ end
- expect(storage_files).to be_a(Storages::StorageFiles)
- expect(storage_files.files).to be_empty
+ context "with a given parent folder", vcr: "one_drive/files_query_parent_folder" do
+ let(:folder) { Storages::Peripherals::ParentFolder.new("/Folder/Subfolder") }
+ let(:files_result) do
+ Storages::StorageFiles.new(
+ [
+ Storages::StorageFile.new(id: "01AZJL5PNCQCEBFI3N7JGZSX5AOX32Z3LA",
+ name: "NextcloudHub.md",
+ size: 1095,
+ mime_type: "application/octet-stream",
+ created_at: Time.zone.parse("2023-09-26T14:45:25Z"),
+ last_modified_at: Time.zone.parse("2023-09-26T14:46:13Z"),
+ created_by_name: "Eric Schubert",
+ last_modified_by_name: "Eric Schubert",
+ location: "/Folder/Subfolder/NextcloudHub.md",
+ permissions: %i[readable writeable]),
+ Storages::StorageFile.new(id: "01AZJL5PLOL2KZTJNVFBCJWFXYGYVBQVMZ",
+ name: "test.txt",
+ size: 28,
+ mime_type: "text/plain",
+ created_at: Time.zone.parse("2023-09-26T14:45:23Z"),
+ last_modified_at: Time.zone.parse("2023-09-26T14:45:45Z"),
+ created_by_name: "Eric Schubert",
+ last_modified_by_name: "Eric Schubert",
+ location: "/Folder/Subfolder/test.txt",
+ permissions: %i[readable writeable])
+ ],
+ Storages::StorageFile.new(id: "01AZJL5PPWP5UOATNRJJBYJG5TACDHEUAG",
+ name: "Subfolder",
+ location: "/Folder/Subfolder",
+ permissions: %i[readable writeable]),
+ [
+ Storages::StorageFile.new(id: "a1d45ff742d2175c095f0a7173f93fc3fc23664a953ceae6778fe15398818c2d",
+ name: "Root",
+ location: "/",
+ permissions: %i[readable writeable]),
+ Storages::StorageFile.new(id: "74ccd43303847f2655300641a934959cdb11689ce171aa0f00faa92917fbd340",
+ name: "Folder",
+ location: "/Folder")
+ ]
+ )
+ end
- # in an empty folder the parent id cannot be retrieved, hence the parent id will get forged
- expect(storage_files.parent.id).to eq("01AZJL5PMGEIRPHZPHRRH2NM3D734VIR7H")
- end
- end
+ it_behaves_like "files_query: successful files response"
+ end
- context "with a path full of umlauts", vcr: "one_drive/files_query_umlauts" do
- let(:folder) { Storages::Peripherals::ParentFolder.new("/Folder/Ümlæûts") }
+ context "with parent folder being empty", vcr: "one_drive/files_query_empty_folder" do
+ let(:folder) { Storages::Peripherals::ParentFolder.new("/Folder with spaces/very empty folder") }
+ let(:files_result) do
+ Storages::StorageFiles.new(
+ [],
+ Storages::StorageFile.new(id: "01AZJL5PMGEIRPHZPHRRH2NM3D734VIR7H",
+ name: "very empty folder",
+ location: "/Folder%20with%20spaces/very%20empty%20folder",
+ permissions: %i[readable writeable]),
+ [
+ Storages::StorageFile.new(id: "a1d45ff742d2175c095f0a7173f93fc3fc23664a953ceae6778fe15398818c2d",
+ name: "Root",
+ location: "/",
+ permissions: %i[readable writeable]),
+ Storages::StorageFile.new(id: "58bde0c7931c8f95bb1bf525471146090630cb72827cb1e63dcaab3a9adce763",
+ name: "Folder with spaces",
+ location: "/Folder%20with%20spaces")
+ ]
+ )
+ end
- it "returns the correct StorageFiles object" do
- storage_files = described_class.call(storage:, auth_strategy:, folder:).result
+ it_behaves_like "files_query: successful files response"
+ end
- expect(storage_files).to be_a(Storages::StorageFiles)
- expect(storage_files.parent.id).to eq("01AZJL5PNQYF5NM3KWYNA3RJHJIB2XMMMB")
- expect(storage_files.parent.name).to eq("Ümlæûts")
- expect(storage_files.parent.location).to eq("/Folder/Ümlæûts")
- expect(storage_files.files.map(&:to_h))
- .to eq([
- {
- id: "01AZJL5PNDURPQGKUSGFCJQJMNNWXKTHSE",
- name: "Anrüchiges deutsches Dokument.docx",
- size: 18007,
- created_at: "2023-10-09T15:26:45Z",
- created_by_name: "Eric Schubert",
- last_modified_at: "2023-10-09T15:27:25Z",
- last_modified_by_name: "Eric Schubert",
- location: "/Folder/%C3%9Cml%C3%A6%C3%BBts/Anr%C3%BCchiges%20deutsches%20Dokument.docx",
- mime_type: "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
- permissions: %i[readable writeable]
- }
- ])
- end
- end
+ context "with a path full of umlauts", vcr: "one_drive/files_query_umlauts" do
+ let(:folder) { Storages::Peripherals::ParentFolder.new("/Folder/Ümlæûts") }
+ let(:files_result) do
+ Storages::StorageFiles.new(
+ [
+ Storages::StorageFile.new(id: "01AZJL5PNDURPQGKUSGFCJQJMNNWXKTHSE",
+ name: "Anrüchiges deutsches Dokument.docx",
+ size: 18007,
+ mime_type: "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
+ created_at: Time.zone.parse("2023-10-09T15:26:45Z"),
+ last_modified_at: Time.zone.parse("2023-10-09T15:27:25Z"),
+ created_by_name: "Eric Schubert",
+ last_modified_by_name: "Eric Schubert",
+ location: "/Folder/%C3%9Cml%C3%A6%C3%BBts/Anr%C3%BCchiges%20deutsches%20Dokument.docx",
+ permissions: %i[readable writeable])
+ ],
+ Storages::StorageFile.new(id: "01AZJL5PNQYF5NM3KWYNA3RJHJIB2XMMMB",
+ name: "Ümlæûts",
+ location: "/Folder/%C3%9Cml%C3%A6%C3%BBts",
+ permissions: %i[readable writeable]),
+ [
+ Storages::StorageFile.new(id: "a1d45ff742d2175c095f0a7173f93fc3fc23664a953ceae6778fe15398818c2d",
+ name: "Root",
+ location: "/",
+ permissions: %i[readable writeable]),
+ Storages::StorageFile.new(id: "74ccd43303847f2655300641a934959cdb11689ce171aa0f00faa92917fbd340",
+ name: "Folder",
+ location: "/Folder")
+ ]
+ )
end
- context "with not existent parent folder", vcr: "one_drive/files_query_invalid_parent" do
- let(:folder) { Storages::Peripherals::ParentFolder.new("/I/just/made/that/up") }
+ it_behaves_like "files_query: successful files response"
+ end
- it "must return not found" do
- result = described_class.call(storage:, auth_strategy:, folder:)
- expect(result).to be_failure
- expect(result.error_source).to eq(described_class)
+ context "with not existent parent folder", vcr: "one_drive/files_query_invalid_parent" do
+ let(:folder) { Storages::Peripherals::ParentFolder.new("/I/just/made/that/up") }
+ let(:error_source) { described_class }
- result.match(
- on_failure: ->(error) { expect(error.code).to eq(:not_found) },
- on_success: ->(file_infos) { fail "Expected failure, got #{file_infos}" }
- )
- end
- end
+ it_behaves_like "files_query: not found"
end
end
diff --git a/modules/storages/spec/common/storages/url_builder_spec.rb b/modules/storages/spec/common/storages/url_builder_spec.rb
index 4beaa817f1e..961a0066ff7 100644
--- a/modules/storages/spec/common/storages/url_builder_spec.rb
+++ b/modules/storages/spec/common/storages/url_builder_spec.rb
@@ -120,6 +120,9 @@ RSpec.describe Storages::UrlBuilder do
describe "path" do
it "returns a correct path concatenation" do
+ expect(described_class.path("")).to eq("/")
+ expect(described_class.path("/")).to eq("/")
+
expect(described_class.path("path")).to eq("/path")
expect(described_class.path("path/")).to eq("/path")
expect(described_class.path("/path")).to eq("/path")
diff --git a/modules/storages/spec/factories/storage_factory.rb b/modules/storages/spec/factories/storage_factory.rb
index 167e21fddf5..491d48196c4 100644
--- a/modules/storages/spec/factories/storage_factory.rb
+++ b/modules/storages/spec/factories/storage_factory.rb
@@ -111,6 +111,7 @@ FactoryBot.define do
traits: [:as_not_automatically_managed] do
transient do
oauth_client_token_user { association :user }
+ origin_user_id { "admin" }
end
name { "Nextcloud Local" }
@@ -144,7 +145,7 @@ FactoryBot.define do
token_type: "bearer")
create(:remote_identity, oauth_client: storage.oauth_client, user: evaluator.oauth_client_token_user,
- origin_user_id: "admin")
+ origin_user_id: evaluator.origin_user_id)
end
end
diff --git a/modules/storages/spec/support/fixtures/vcr_cassettes/nextcloud/files_query_empty_folder.yml b/modules/storages/spec/support/fixtures/vcr_cassettes/nextcloud/files_query_empty_folder.yml
index 3a19611bbe5..c327ec0774c 100644
--- a/modules/storages/spec/support/fixtures/vcr_cassettes/nextcloud/files_query_empty_folder.yml
+++ b/modules/storages/spec/support/fixtures/vcr_cassettes/nextcloud/files_query_empty_folder.yml
@@ -2,7 +2,7 @@
http_interactions:
- request:
method: propfind
- uri: https://nextcloud.local/remote.php/dav/files/admin/Folder/empty
+ uri: https://nextcloud.local/remote.php/dav/files/[email protected]/Folder%20with%20spaces/very%20empty%20folder
body:
encoding: UTF-8
string: |
@@ -21,13 +21,17 @@ http_interactions:
Depth:
- '1'
Authorization:
- - Bearer <ACCESS_TOKEN>
- Accept-Encoding:
- - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
+ - Bearer <BEARER TOKEN>
+ User-Agent:
+ - httpx.rb/1.3.0
Accept:
- "*/*"
- User-Agent:
- - Ruby
+ Accept-Encoding:
+ - gzip, deflate
+ Content-Type:
+ - application/xml; charset=utf-8
+ Content-Length:
+ - '253'
response:
status:
code: 207
@@ -35,14 +39,14 @@ http_interactions:
headers:
Cache-Control:
- no-store, no-cache, must-revalidate
- Content-Length:
- - '642'
+ Content-Encoding:
+ - gzip
Content-Security-Policy:
- default-src 'none';
Content-Type:
- application/xml; charset=utf-8
Date:
- - Wed, 29 Nov 2023 15:45:31 GMT
+ - Fri, 09 Aug 2024 12:11:51 GMT
Dav:
- 1, 3, extended-mkcol, access-control, calendarserver-principal-property-search,
nextcloud-checksum-update, nc-calendar-search, nc-enable-birthday-calendar
@@ -53,46 +57,46 @@ http_interactions:
Referrer-Policy:
- no-referrer
Server:
- - Apache/2.4.57 (Debian)
+ - Apache/2.4.59 (Debian)
Set-Cookie:
- - __Host-nc_sameSiteCookielax=true; path=/; httponly;secure; expires=Fri, 31-Dec-2100
- 23:59:59 GMT; SameSite=lax
- - __Host-nc_sameSiteCookiestrict=true; path=/; httponly;secure; expires=Fri,
- 31-Dec-2100 23:59:59 GMT; SameSite=strict
- - oc_sessionPassphrase=22EqvC5iCSsL87itrDPml%2BkF6aOUj79GbuodxMNmF04ZQPKog6y5BvL4iU80hQZS24xkgYLO%2FhmBf98JM7q%2Brl2HSCJ9DstQH8KZwDV8BrS6XNjxnhLWBWf7Jp4kMk4Y;
+ - oc07ul6b4oaw=c272d22b7ef10a054561e57d0e5d2308; path=/; secure; HttpOnly; SameSite=Lax,
+ oc_sessionPassphrase=HYt%2F8%2BEcBasj7xEiIVXD01ty1ZGw8StGwXJnhn1m6odmNUOcn8ydP%2FCX1teHG6fgJRzGlINfXZUqOMvzVr4qPztOgsgCn5mIY%2FjkoXyQNSkQjEPuvtqXM4qvJxWCwLvA;
+ path=/; secure; HttpOnly; SameSite=Lax, oc07ul6b4oaw=c272d22b7ef10a054561e57d0e5d2308;
+ path=/; secure; HttpOnly; SameSite=Lax, __Host-nc_sameSiteCookielax=true;
+ path=/; httponly;secure; expires=Fri, 31-Dec-2100 23:59:59 GMT; SameSite=lax,
+ __Host-nc_sameSiteCookiestrict=true; path=/; httponly;secure; expires=Fri,
+ 31-Dec-2100 23:59:59 GMT; SameSite=strict, oc07ul6b4oaw=c272d22b7ef10a054561e57d0e5d2308;
+ path=/; secure; HttpOnly; SameSite=Lax, oc07ul6b4oaw=c272d22b7ef10a054561e57d0e5d2308;
+ path=/; secure; HttpOnly; SameSite=Lax, oc07ul6b4oaw=c272d22b7ef10a054561e57d0e5d2308;
+ path=/; secure; HttpOnly; SameSite=Lax, oc07ul6b4oaw=c272d22b7ef10a054561e57d0e5d2308;
+ path=/; secure; HttpOnly; SameSite=Lax, oc07ul6b4oaw=c272d22b7ef10a054561e57d0e5d2308;
+ path=/; secure; HttpOnly; SameSite=Lax, oc07ul6b4oaw=c272d22b7ef10a054561e57d0e5d2308;
+ path=/; secure; HttpOnly; SameSite=Lax, oc07ul6b4oaw=c272d22b7ef10a054561e57d0e5d2308;
path=/; secure; HttpOnly; SameSite=Lax
- - ocirabgzify6=53b37579a2a843efd20055cdb5509976; path=/; secure; HttpOnly; SameSite=Lax
- - ocirabgzify6=53b37579a2a843efd20055cdb5509976; path=/; secure; HttpOnly; SameSite=Lax
- - ocirabgzify6=53b37579a2a843efd20055cdb5509976; path=/; secure; HttpOnly; SameSite=Lax
- - ocirabgzify6=53b37579a2a843efd20055cdb5509976; path=/; secure; HttpOnly; SameSite=Lax
- - ocirabgzify6=53b37579a2a843efd20055cdb5509976; path=/; secure; HttpOnly; SameSite=Lax
- - ocirabgzify6=53b37579a2a843efd20055cdb5509976; path=/; secure; HttpOnly; SameSite=Lax
- - ocirabgzify6=53b37579a2a843efd20055cdb5509976; path=/; secure; HttpOnly; SameSite=Lax
- - ocirabgzify6=53b37579a2a843efd20055cdb5509976; path=/; secure; HttpOnly; SameSite=Lax
- - ocirabgzify6=53b37579a2a843efd20055cdb5509976; path=/; secure; HttpOnly; SameSite=Lax
- - ocirabgzify6=9ef63f90ae539c41f094193243b80bdf; path=/; secure; HttpOnly; SameSite=Lax
Vary:
- Brief,Prefer
X-Content-Type-Options:
- nosniff
X-Debug-Token:
- - BnfzarP0I9NC7ERZOIJE
+ - lMaRoq2MnNaw9tg6xmNo
X-Frame-Options:
- SAMEORIGIN
X-Permitted-Cross-Domain-Policies:
- none
X-Powered-By:
- - PHP/8.2.13
+ - PHP/8.2.21
X-Request-Id:
- - BnfzarP0I9NC7ERZOIJE
+ - lMaRoq2MnNaw9tg6xmNo
X-Robots-Tag:
- noindex, nofollow
X-Xss-Protection:
- 1; mode=block
+ Content-Length:
+ - '383'
body:
encoding: UTF-8
string: |
<?xml version="1.0"?>
- <d:multistatus xmlns:d="DAV:" xmlns:s="http://sabredav.org/ns" xmlns:oc="http://owncloud.org/ns" xmlns:nc="http://nextcloud.org/ns"><d:response><d:href>/remote.php/dav/files/admin/Folder/empty/</d:href><d:propstat><d:prop><oc:fileid>174</oc:fileid><oc:size>0</oc:size><d:getlastmodified>Wed, 29 Nov 2023 13:20:49 GMT</d:getlastmodified><oc:permissions>RGDNVCK</oc:permissions><oc:owner-display-name>admin</oc:owner-display-name></d:prop><d:status>HTTP/1.1 200 OK</d:status></d:propstat><d:propstat><d:prop><d:getcontenttype/></d:prop><d:status>HTTP/1.1 404 Not Found</d:status></d:propstat></d:response></d:multistatus>
- recorded_at: Wed, 29 Nov 2023 15:45:31 GMT
+ <d:multistatus xmlns:d="DAV:" xmlns:s="http://sabredav.org/ns" xmlns:oc="http://owncloud.org/ns" xmlns:nc="http://nextcloud.org/ns"><d:response><d:href>/remote.php/dav/files/[email protected]/Folder%20with%20spaces/very%20empty%20folder/</d:href><d:propstat><d:prop><oc:fileid>571</oc:fileid><oc:size>0</oc:size><d:getlastmodified>Fri, 09 Aug 2024 11:52:04 GMT</d:getlastmodified><oc:permissions>RGDNVCK</oc:permissions><oc:owner-display-name>Mara Jade</oc:owner-display-name></d:prop><d:status>HTTP/1.1 200 OK</d:status></d:propstat><d:propstat><d:prop><d:getcontenttype/></d:prop><d:status>HTTP/1.1 404 Not Found</d:status></d:propstat></d:response></d:multistatus>
+ recorded_at: Fri, 09 Aug 2024 12:11:51 GMT
recorded_with: VCR 6.2.0
diff --git a/modules/storages/spec/support/fixtures/vcr_cassettes/nextcloud/files_query_invalid_parent.yml b/modules/storages/spec/support/fixtures/vcr_cassettes/nextcloud/files_query_invalid_parent.yml
index 70d2aaf028e..70318402b42 100644
--- a/modules/storages/spec/support/fixtures/vcr_cassettes/nextcloud/files_query_invalid_parent.yml
+++ b/modules/storages/spec/support/fixtures/vcr_cassettes/nextcloud/files_query_invalid_parent.yml
@@ -2,7 +2,7 @@
http_interactions:
- request:
method: propfind
- uri: https://nextcloud.local/remote.php/dav/files/admin/I/just/made/that/up
+ uri: https://nextcloud.local/remote.php/dav/files/[email protected]/I/just/made/that/up
body:
encoding: UTF-8
string: |
@@ -21,13 +21,17 @@ http_interactions:
Depth:
- '1'
Authorization:
- - Bearer <ACCESS_TOKEN>
- Accept-Encoding:
- - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
+ - Bearer <BEARER TOKEN>
+ User-Agent:
+ - httpx.rb/1.3.0
Accept:
- "*/*"
- User-Agent:
- - Ruby
+ Accept-Encoding:
+ - gzip, deflate
+ Content-Type:
+ - application/xml; charset=utf-8
+ Content-Length:
+ - '253'
response:
status:
code: 404
@@ -35,14 +39,12 @@ http_interactions:
headers:
Cache-Control:
- no-store, no-cache, must-revalidate
- Content-Length:
- - '231'
Content-Security-Policy:
- default-src 'none';
Content-Type:
- application/xml; charset=utf-8
Date:
- - Wed, 29 Nov 2023 15:45:31 GMT
+ - Fri, 09 Aug 2024 12:11:52 GMT
Dav:
- 1, 3, extended-mkcol, access-control, calendarserver-principal-property-search,
nextcloud-checksum-update, nc-calendar-search, nc-enable-birthday-calendar
@@ -53,24 +55,22 @@ http_interactions:
Referrer-Policy:
- no-referrer
Server:
- - Apache/2.4.57 (Debian)
+ - Apache/2.4.59 (Debian)
Set-Cookie:
- - __Host-nc_sameSiteCookielax=true; path=/; httponly;secure; expires=Fri, 31-Dec-2100
- 23:59:59 GMT; SameSite=lax
- - __Host-nc_sameSiteCookiestrict=true; path=/; httponly;secure; expires=Fri,
- 31-Dec-2100 23:59:59 GMT; SameSite=strict
- - oc_sessionPassphrase=AuJ23gTtnDdXny94O5aZVzdnJweQRNRURJtvHaNmNCsLKR6zrr6SFgwx09HomshABCrw6slULrxyYOfwbnCqJGzSVC9SCKp5YflugSzmPJfBfwURLU2GQnICBPsfFFCL;
+ - oc07ul6b4oaw=f4d50c13d9164289d13a866692efa48a; path=/; secure; HttpOnly; SameSite=Lax,
+ oc_sessionPassphrase=oqT01XZaayqzYUvHRDZ%2FeHzyLeQ0Rrma0udQYfhP%2BorQG9FPQu8oIf9SWX6CUXZCbYAGBJZZrpTaO7OH7lhIQXi7tKT4Pc1owXv8TmPRLS3DPSHd2W4gWM3Y3XgrKpb%2F;
+ path=/; secure; HttpOnly; SameSite=Lax, oc07ul6b4oaw=f4d50c13d9164289d13a866692efa48a;
+ path=/; secure; HttpOnly; SameSite=Lax, __Host-nc_sameSiteCookielax=true;
+ path=/; httponly;secure; expires=Fri, 31-Dec-2100 23:59:59 GMT; SameSite=lax,
+ __Host-nc_sameSiteCookiestrict=true; path=/; httponly;secure; expires=Fri,
+ 31-Dec-2100 23:59:59 GMT; SameSite=strict, oc07ul6b4oaw=f4d50c13d9164289d13a866692efa48a;
+ path=/; secure; HttpOnly; SameSite=Lax, oc07ul6b4oaw=f4d50c13d9164289d13a866692efa48a;
+ path=/; secure; HttpOnly; SameSite=Lax, oc07ul6b4oaw=f4d50c13d9164289d13a866692efa48a;
+ path=/; secure; HttpOnly; SameSite=Lax, oc07ul6b4oaw=f4d50c13d9164289d13a866692efa48a;
+ path=/; secure; HttpOnly; SameSite=Lax, oc07ul6b4oaw=f4d50c13d9164289d13a866692efa48a;
+ path=/; secure; HttpOnly; SameSite=Lax, oc07ul6b4oaw=f4d50c13d9164289d13a866692efa48a;
+ path=/; secure; HttpOnly; SameSite=Lax, oc07ul6b4oaw=f4d50c13d9164289d13a866692efa48a;
path=/; secure; HttpOnly; SameSite=Lax
- - ocirabgzify6=93109f99dfe19218102d5dc8b2e3cc40; path=/; secure; HttpOnly; SameSite=Lax
- - ocirabgzify6=b4faf57238eda6bee9a3397e7989534e; path=/; secure; HttpOnly; SameSite=Lax
- - ocirabgzify6=b4faf57238eda6bee9a3397e7989534e; path=/; secure; HttpOnly; SameSite=Lax
- - ocirabgzify6=b4faf57238eda6bee9a3397e7989534e; path=/; secure; HttpOnly; SameSite=Lax
- - ocirabgzify6=b4faf57238eda6bee9a3397e7989534e; path=/; secure; HttpOnly; SameSite=Lax
- - ocirabgzify6=b4faf57238eda6bee9a3397e7989534e; path=/; secure; HttpOnly; SameSite=Lax
- - ocirabgzify6=b4faf57238eda6bee9a3397e7989534e; path=/; secure; HttpOnly; SameSite=Lax
- - ocirabgzify6=b4faf57238eda6bee9a3397e7989534e; path=/; secure; HttpOnly; SameSite=Lax
- - ocirabgzify6=b4faf57238eda6bee9a3397e7989534e; path=/; secure; HttpOnly; SameSite=Lax
- - ocirabgzify6=b4faf57238eda6bee9a3397e7989534e; path=/; secure; HttpOnly; SameSite=Lax
Vary:
- Brief,Prefer
X-Content-Type-Options:
@@ -80,11 +80,13 @@ http_interactions:
X-Permitted-Cross-Domain-Policies:
- none
X-Powered-By:
- - PHP/8.2.13
+ - PHP/8.2.21
X-Robots-Tag:
- noindex, nofollow
X-Xss-Protection:
- 1; mode=block
+ Content-Length:
+ - '231'
body:
encoding: UTF-8
string: |
@@ -93,5 +95,5 @@ http_interactions:
<s:exception>Sabre\DAV\Exception\NotFound</s:exception>
<s:message>File with name //I could not be located</s:message>
</d:error>
- recorded_at: Wed, 29 Nov 2023 15:45:31 GMT
+ recorded_at: Fri, 09 Aug 2024 12:11:52 GMT
recorded_with: VCR 6.2.0
diff --git a/modules/storages/spec/support/fixtures/vcr_cassettes/nextcloud/files_query_parent_folder.yml b/modules/storages/spec/support/fixtures/vcr_cassettes/nextcloud/files_query_parent_folder.yml
index 8568da03b39..74ee796edba 100644
--- a/modules/storages/spec/support/fixtures/vcr_cassettes/nextcloud/files_query_parent_folder.yml
+++ b/modules/storages/spec/support/fixtures/vcr_cassettes/nextcloud/files_query_parent_folder.yml
@@ -2,7 +2,7 @@
http_interactions:
- request:
method: propfind
- uri: https://nextcloud.local/remote.php/dav/files/admin/Folder%20with%20spaces/New%20Requests
+ uri: https://nextcloud.local/remote.php/dav/files/[email protected]/Folder/Nested%20Folder
body:
encoding: UTF-8
string: |
@@ -21,13 +21,17 @@ http_interactions:
Depth:
- '1'
Authorization:
- - Bearer <ACCESS_TOKEN>
- Accept-Encoding:
- - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
+ - Bearer <BEARER TOKEN>
+ User-Agent:
+ - httpx.rb/1.3.0
Accept:
- "*/*"
- User-Agent:
- - Ruby
+ Accept-Encoding:
+ - gzip, deflate
+ Content-Type:
+ - application/xml; charset=utf-8
+ Content-Length:
+ - '253'
response:
status:
code: 207
@@ -35,14 +39,14 @@ http_interactions:
headers:
Cache-Control:
- no-store, no-cache, must-revalidate
- Content-Length:
- - '1580'
+ Content-Encoding:
+ - gzip
Content-Security-Policy:
- default-src 'none';
Content-Type:
- application/xml; charset=utf-8
Date:
- - Wed, 29 Nov 2023 15:45:31 GMT
+ - Fri, 09 Aug 2024 12:11:51 GMT
Dav:
- 1, 3, extended-mkcol, access-control, calendarserver-principal-property-search,
nextcloud-checksum-update, nc-calendar-search, nc-enable-birthday-calendar
@@ -53,46 +57,46 @@ http_interactions:
Referrer-Policy:
- no-referrer
Server:
- - Apache/2.4.57 (Debian)
+ - Apache/2.4.59 (Debian)
Set-Cookie:
- - __Host-nc_sameSiteCookielax=true; path=/; httponly;secure; expires=Fri, 31-Dec-2100
- 23:59:59 GMT; SameSite=lax
- - __Host-nc_sameSiteCookiestrict=true; path=/; httponly;secure; expires=Fri,
- 31-Dec-2100 23:59:59 GMT; SameSite=strict
- - oc_sessionPassphrase=ZUGkvN6AtRd3BMd9WNLyNUlbyLsJl7lrAbm8b3bQh9fLnDZpObjSBgEKxxuLTP%2BOSYpi5LBdL1rsvMcLCH3l2cuWWaoJzBtM6UQP6qwRIi44%2BCR4Co%2BWJ3XntkwW2thI;
+ - oc07ul6b4oaw=64d64f812c9648275f44b170982350bb; path=/; secure; HttpOnly; SameSite=Lax,
+ oc_sessionPassphrase=dhivPf06ezPZQDmZws1Q9%2FcOy8cSjLaZ4ZpcE3Hv%2F8gf%2BAtkyDu6wQpb0lkxtT01%2BjRZFlnLmxdhKR9GlS1l3Z5MtDOJ9e3wFqS3RFOzXQb48d2VUCnXOjPyYVyBs2Lk;
+ path=/; secure; HttpOnly; SameSite=Lax, oc07ul6b4oaw=64d64f812c9648275f44b170982350bb;
+ path=/; secure; HttpOnly; SameSite=Lax, __Host-nc_sameSiteCookielax=true;
+ path=/; httponly;secure; expires=Fri, 31-Dec-2100 23:59:59 GMT; SameSite=lax,
+ __Host-nc_sameSiteCookiestrict=true; path=/; httponly;secure; expires=Fri,
+ 31-Dec-2100 23:59:59 GMT; SameSite=strict, oc07ul6b4oaw=64d64f812c9648275f44b170982350bb;
+ path=/; secure; HttpOnly; SameSite=Lax, oc07ul6b4oaw=64d64f812c9648275f44b170982350bb;
+ path=/; secure; HttpOnly; SameSite=Lax, oc07ul6b4oaw=64d64f812c9648275f44b170982350bb;
+ path=/; secure; HttpOnly; SameSite=Lax, oc07ul6b4oaw=64d64f812c9648275f44b170982350bb;
+ path=/; secure; HttpOnly; SameSite=Lax, oc07ul6b4oaw=64d64f812c9648275f44b170982350bb;
+ path=/; secure; HttpOnly; SameSite=Lax, oc07ul6b4oaw=64d64f812c9648275f44b170982350bb;
+ path=/; secure; HttpOnly; SameSite=Lax, oc07ul6b4oaw=64d64f812c9648275f44b170982350bb;
path=/; secure; HttpOnly; SameSite=Lax
- - ocirabgzify6=7e810689e8d2f5d3afc1b95304ecbaa5; path=/; secure; HttpOnly; SameSite=Lax
- - ocirabgzify6=8f0dd038af1514461c89134f5fbf5d50; path=/; secure; HttpOnly; SameSite=Lax
- - ocirabgzify6=8f0dd038af1514461c89134f5fbf5d50; path=/; secure; HttpOnly; SameSite=Lax
- - ocirabgzify6=8f0dd038af1514461c89134f5fbf5d50; path=/; secure; HttpOnly; SameSite=Lax
- - ocirabgzify6=8f0dd038af1514461c89134f5fbf5d50; path=/; secure; HttpOnly; SameSite=Lax
- - ocirabgzify6=8f0dd038af1514461c89134f5fbf5d50; path=/; secure; HttpOnly; SameSite=Lax
- - ocirabgzify6=8f0dd038af1514461c89134f5fbf5d50; path=/; secure; HttpOnly; SameSite=Lax
- - ocirabgzify6=8f0dd038af1514461c89134f5fbf5d50; path=/; secure; HttpOnly; SameSite=Lax
- - ocirabgzify6=8f0dd038af1514461c89134f5fbf5d50; path=/; secure; HttpOnly; SameSite=Lax
- - ocirabgzify6=8f0dd038af1514461c89134f5fbf5d50; path=/; secure; HttpOnly; SameSite=Lax
Vary:
- Brief,Prefer
X-Content-Type-Options:
- nosniff
X-Debug-Token:
- - bWE99kGYKlvLkfbLzVa5
+ - ME7ZNWNYlt0umkVa3tm2
X-Frame-Options:
- SAMEORIGIN
X-Permitted-Cross-Domain-Policies:
- none
X-Powered-By:
- - PHP/8.2.13
+ - PHP/8.2.21
X-Request-Id:
- - bWE99kGYKlvLkfbLzVa5
+ - ME7ZNWNYlt0umkVa3tm2
X-Robots-Tag:
- noindex, nofollow
X-Xss-Protection:
- 1; mode=block
+ Content-Length:
+ - '499'
body:
encoding: UTF-8
string: |
<?xml version="1.0"?>
- <d:multistatus xmlns:d="DAV:" xmlns:s="http://sabredav.org/ns" xmlns:oc="http://owncloud.org/ns" xmlns:nc="http://nextcloud.org/ns"><d:response><d:href>/remote.php/dav/files/admin/Folder%20with%20spaces/New%20Requests/</d:href><d:propstat><d:prop><oc:fileid>180</oc:fileid><oc:size>74</oc:size><d:getlastmodified>Wed, 29 Nov 2023 15:42:21 GMT</d:getlastmodified><oc:permissions>RGDNVCK</oc:permissions><oc:owner-display-name>admin</oc:owner-display-name></d:prop><d:status>HTTP/1.1 200 OK</d:status></d:propstat><d:propstat><d:prop><d:getcontenttype/></d:prop><d:status>HTTP/1.1 404 Not Found</d:status></d:propstat></d:response><d:response><d:href>/remote.php/dav/files/admin/Folder%20with%20spaces/New%20Requests/request_001.md</d:href><d:propstat><d:prop><oc:fileid>181</oc:fileid><oc:size>48</oc:size><d:getcontenttype>text/markdown</d:getcontenttype><d:getlastmodified>Wed, 29 Nov 2023 15:35:25 GMT</d:getlastmodified><oc:permissions>RGDNVW</oc:permissions><oc:owner-display-name>admin</oc:owner-display-name></d:prop><d:status>HTTP/1.1 200 OK</d:status></d:propstat></d:response><d:response><d:href>/remote.php/dav/files/admin/Folder%20with%20spaces/New%20Requests/request_002.md</d:href><d:propstat><d:prop><oc:fileid>182</oc:fileid><oc:size>26</oc:size><d:getcontenttype>text/markdown</d:getcontenttype><d:getlastmodified>Wed, 29 Nov 2023 15:35:34 GMT</d:getlastmodified><oc:permissions>RGDNVW</oc:permissions><oc:owner-display-name>admin</oc:owner-display-name></d:prop><d:status>HTTP/1.1 200 OK</d:status></d:propstat></d:response></d:multistatus>
- recorded_at: Wed, 29 Nov 2023 15:45:31 GMT
+ <d:multistatus xmlns:d="DAV:" xmlns:s="http://sabredav.org/ns" xmlns:oc="http://owncloud.org/ns" xmlns:nc="http://nextcloud.org/ns"><d:response><d:href>/remote.php/dav/files/[email protected]/Folder/Nested%20Folder/</d:href><d:propstat><d:prop><oc:fileid>601</oc:fileid><oc:size>231045</oc:size><d:getlastmodified>Fri, 09 Aug 2024 11:53:42 GMT</d:getlastmodified><oc:permissions>RGDNVCK</oc:permissions><oc:owner-display-name>Mara Jade</oc:owner-display-name></d:prop><d:status>HTTP/1.1 200 OK</d:status></d:propstat><d:propstat><d:prop><d:getcontenttype/></d:prop><d:status>HTTP/1.1 404 Not Found</d:status></d:propstat></d:response><d:response><d:href>/remote.php/dav/files/[email protected]/Folder/Nested%20Folder/giphy.gif</d:href><d:propstat><d:prop><oc:fileid>603</oc:fileid><oc:size>184726</oc:size><d:getcontenttype>image/gif</d:getcontenttype><d:getlastmodified>Fri, 09 Aug 2024 11:53:24 GMT</d:getlastmodified><oc:permissions>RGDNVW</oc:permissions><oc:owner-display-name>Mara Jade</oc:owner-display-name></d:prop><d:status>HTTP/1.1 200 OK</d:status></d:propstat></d:response><d:response><d:href>/remote.php/dav/files/[email protected]/Folder/Nested%20Folder/release_meme.jpg</d:href><d:propstat><d:prop><oc:fileid>604</oc:fileid><oc:size>46264</oc:size><d:getcontenttype>image/jpeg</d:getcontenttype><d:getlastmodified>Fri, 09 Aug 2024 11:53:30 GMT</d:getlastmodified><oc:permissions>RGDNVW</oc:permissions><oc:owner-display-name>Mara Jade</oc:owner-display-name></d:prop><d:status>HTTP/1.1 200 OK</d:status></d:propstat></d:response><d:response><d:href>/remote.php/dav/files/[email protected]/Folder/Nested%20Folder/todo.txt</d:href><d:propstat><d:prop><oc:fileid>602</oc:fileid><oc:size>55</oc:size><d:getcontenttype>text/plain</d:getcontenttype><d:getlastmodified>Fri, 09 Aug 2024 11:53:35 GMT</d:getlastmodified><oc:permissions>RGDNVW</oc:permissions><oc:owner-display-name>Mara Jade</oc:owner-display-name></d:prop><d:status>HTTP/1.1 200 OK</d:status></d:propstat></d:response></d:multistatus>
+ recorded_at: Fri, 09 Aug 2024 12:11:51 GMT
recorded_with: VCR 6.2.0
diff --git a/modules/storages/spec/support/fixtures/vcr_cassettes/nextcloud/files_query_root.yml b/modules/storages/spec/support/fixtures/vcr_cassettes/nextcloud/files_query_root.yml
index 36f74cde53d..57319dd619a 100644
--- a/modules/storages/spec/support/fixtures/vcr_cassettes/nextcloud/files_query_root.yml
+++ b/modules/storages/spec/support/fixtures/vcr_cassettes/nextcloud/files_query_root.yml
@@ -2,7 +2,7 @@
http_interactions:
- request:
method: propfind
- uri: https://nextcloud.local/remote.php/dav/files/admin
+ uri: https://nextcloud.local/remote.php/dav/files/[email protected]
body:
encoding: UTF-8
string: |
@@ -21,13 +21,17 @@ http_interactions:
Depth:
- '1'
Authorization:
- - Bearer <ACCESS_TOKEN>
- Accept-Encoding:
- - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
+ - Bearer <BEARER TOKEN>
+ User-Agent:
+ - httpx.rb/1.3.0
Accept:
- "*/*"
- User-Agent:
- - Ruby
+ Accept-Encoding:
+ - gzip, deflate
+ Content-Type:
+ - application/xml; charset=utf-8
+ Content-Length:
+ - '253'
response:
status:
code: 207
@@ -35,14 +39,14 @@ http_interactions:
headers:
Cache-Control:
- no-store, no-cache, must-revalidate
- Content-Length:
- - '2453'
+ Content-Encoding:
+ - gzip
Content-Security-Policy:
- default-src 'none';
Content-Type:
- application/xml; charset=utf-8
Date:
- - Wed, 29 Nov 2023 15:45:31 GMT
+ - Fri, 09 Aug 2024 12:11:50 GMT
Dav:
- 1, 3, extended-mkcol, access-control, calendarserver-principal-property-search,
nextcloud-checksum-update, nc-calendar-search, nc-enable-birthday-calendar
@@ -53,46 +57,46 @@ http_interactions:
Referrer-Policy:
- no-referrer
Server:
- - Apache/2.4.57 (Debian)
+ - Apache/2.4.59 (Debian)
Set-Cookie:
- - __Host-nc_sameSiteCookielax=true; path=/; httponly;secure; expires=Fri, 31-Dec-2100
- 23:59:59 GMT; SameSite=lax
- - __Host-nc_sameSiteCookiestrict=true; path=/; httponly;secure; expires=Fri,
- 31-Dec-2100 23:59:59 GMT; SameSite=strict
- - oc_sessionPassphrase=GbRpWHnYMah5MsH1g4BlOE84L%2BO6UTAjmpWwjYhUXRZb%2Bj28Odo72%2Bw9sOzYxfHX8eHk3Ym5PAD9Upai2RuXrhdGPZt7nb5MQdrX4LEUZzAlpT7eaR5QWQPeYVeSQmym;
+ - oc07ul6b4oaw=7fd960b17651b95da60f5092d2fa0c31; path=/; secure; HttpOnly; SameSite=Lax,
+ oc_sessionPassphrase=IPDLLRfSWy1v9B%2FUISZry9i0KbX6aI9IetOxIUSaBUtedgbz9LRK%2B5%2FbUrdA5VZ5nvgF7KcYrHPjirMLRq5Ws9FeIDvKeZURKBqxEd9mdWAAtYFzpzP2q2rBhCNsPoQP;
+ path=/; secure; HttpOnly; SameSite=Lax, oc07ul6b4oaw=7fd960b17651b95da60f5092d2fa0c31;
+ path=/; secure; HttpOnly; SameSite=Lax, __Host-nc_sameSiteCookielax=true;
+ path=/; httponly;secure; expires=Fri, 31-Dec-2100 23:59:59 GMT; SameSite=lax,
+ __Host-nc_sameSiteCookiestrict=true; path=/; httponly;secure; expires=Fri,
+ 31-Dec-2100 23:59:59 GMT; SameSite=strict, oc07ul6b4oaw=7fd960b17651b95da60f5092d2fa0c31;
+ path=/; secure; HttpOnly; SameSite=Lax, oc07ul6b4oaw=7fd960b17651b95da60f5092d2fa0c31;
+ path=/; secure; HttpOnly; SameSite=Lax, oc07ul6b4oaw=7fd960b17651b95da60f5092d2fa0c31;
+ path=/; secure; HttpOnly; SameSite=Lax, oc07ul6b4oaw=7fd960b17651b95da60f5092d2fa0c31;
+ path=/; secure; HttpOnly; SameSite=Lax, oc07ul6b4oaw=7fd960b17651b95da60f5092d2fa0c31;
+ path=/; secure; HttpOnly; SameSite=Lax, oc07ul6b4oaw=7fd960b17651b95da60f5092d2fa0c31;
+ path=/; secure; HttpOnly; SameSite=Lax, oc07ul6b4oaw=7fd960b17651b95da60f5092d2fa0c31;
path=/; secure; HttpOnly; SameSite=Lax
- - ocirabgzify6=122d05aec559552ba065da6d97dac314; path=/; secure; HttpOnly; SameSite=Lax
- - ocirabgzify6=122d05aec559552ba065da6d97dac314; path=/; secure; HttpOnly; SameSite=Lax
- - ocirabgzify6=122d05aec559552ba065da6d97dac314; path=/; secure; HttpOnly; SameSite=Lax
- - ocirabgzify6=122d05aec559552ba065da6d97dac314; path=/; secure; HttpOnly; SameSite=Lax
- - ocirabgzify6=122d05aec559552ba065da6d97dac314; path=/; secure; HttpOnly; SameSite=Lax
- - ocirabgzify6=122d05aec559552ba065da6d97dac314; path=/; secure; HttpOnly; SameSite=Lax
- - ocirabgzify6=122d05aec559552ba065da6d97dac314; path=/; secure; HttpOnly; SameSite=Lax
- - ocirabgzify6=122d05aec559552ba065da6d97dac314; path=/; secure; HttpOnly; SameSite=Lax
- - ocirabgzify6=122d05aec559552ba065da6d97dac314; path=/; secure; HttpOnly; SameSite=Lax
- - ocirabgzify6=dbc8dc90dbf91d3af72e31d7fe2c39d6; path=/; secure; HttpOnly; SameSite=Lax
Vary:
- Brief,Prefer
X-Content-Type-Options:
- nosniff
X-Debug-Token:
- - xYiM1mg2MIoYdIaOxFHf
+ - qkHg5uq5mx1iEfMwG8hG
X-Frame-Options:
- SAMEORIGIN
X-Permitted-Cross-Domain-Policies:
- none
X-Powered-By:
- - PHP/8.2.13
+ - PHP/8.2.21
X-Request-Id:
- - xYiM1mg2MIoYdIaOxFHf
+ - qkHg5uq5mx1iEfMwG8hG
X-Robots-Tag:
- noindex, nofollow
X-Xss-Protection:
- 1; mode=block
+ Content-Length:
+ - '458'
body:
encoding: UTF-8
string: |
<?xml version="1.0"?>
- <d:multistatus xmlns:d="DAV:" xmlns:s="http://sabredav.org/ns" xmlns:oc="http://owncloud.org/ns" xmlns:nc="http://nextcloud.org/ns"><d:response><d:href>/remote.php/dav/files/admin/</d:href><d:propstat><d:prop><oc:fileid>2</oc:fileid><oc:size>1137306515</oc:size><d:getlastmodified>Wed, 29 Nov 2023 15:42:21 GMT</d:getlastmodified><oc:permissions>RGDNVCK</oc:permissions><oc:owner-display-name>admin</oc:owner-display-name></d:prop><d:status>HTTP/1.1 200 OK</d:status></d:propstat><d:propstat><d:prop><d:getcontenttype/></d:prop><d:status>HTTP/1.1 404 Not Found</d:status></d:propstat></d:response><d:response><d:href>/remote.php/dav/files/admin/Folder/</d:href><d:propstat><d:prop><oc:fileid>172</oc:fileid><oc:size>982713473</oc:size><d:getlastmodified>Wed, 29 Nov 2023 15:31:30 GMT</d:getlastmodified><oc:permissions>RGDNVCK</oc:permissions><oc:owner-display-name>admin</oc:owner-display-name></d:prop><d:status>HTTP/1.1 200 OK</d:status></d:propstat><d:propstat><d:prop><d:getcontenttype/></d:prop><d:status>HTTP/1.1 404 Not Found</d:status></d:propstat></d:response><d:response><d:href>/remote.php/dav/files/admin/Folder%20with%20spaces/</d:href><d:propstat><d:prop><oc:fileid>173</oc:fileid><oc:size>74</oc:size><d:getlastmodified>Wed, 29 Nov 2023 15:42:21 GMT</d:getlastmodified><oc:permissions>RGDNVCK</oc:permissions><oc:owner-display-name>admin</oc:owner-display-name></d:prop><d:status>HTTP/1.1 200 OK</d:status></d:propstat><d:propstat><d:prop><d:getcontenttype/></d:prop><d:status>HTTP/1.1 404 Not Found</d:status></d:propstat></d:response><d:response><d:href>/remote.php/dav/files/admin/Practical_guide_to_BAGGM_Digital.pdf</d:href><d:propstat><d:prop><oc:fileid>211</oc:fileid><oc:size>154592937</oc:size><d:getcontenttype>application/pdf</d:getcontenttype><d:getlastmodified>Tue, 09 Aug 2022 06:53:12 GMT</d:getlastmodified><oc:permissions>RGDNVW</oc:permissions><oc:owner-display-name>admin</oc:owner-display-name></d:prop><d:status>HTTP/1.1 200 OK</d:status></d:propstat></d:response><d:response><d:href>/remote.php/dav/files/admin/Readme.md</d:href><d:propstat><d:prop><oc:fileid>178</oc:fileid><oc:size>31</oc:size><d:getcontenttype>text/markdown</d:getcontenttype><d:getlastmodified>Wed, 29 Nov 2023 15:29:16 GMT</d:getlastmodified><oc:permissions>RGDNVW</oc:permissions><oc:owner-display-name>admin</oc:owner-display-name></d:prop><d:status>HTTP/1.1 200 OK</d:status></d:propstat></d:response></d:multistatus>
- recorded_at: Wed, 29 Nov 2023 15:45:31 GMT
+ <d:multistatus xmlns:d="DAV:" xmlns:s="http://sabredav.org/ns" xmlns:oc="http://owncloud.org/ns" xmlns:nc="http://nextcloud.org/ns"><d:response><d:href>/remote.php/dav/files/[email protected]/</d:href><d:propstat><d:prop><oc:fileid>385</oc:fileid><oc:size>252777</oc:size><d:getlastmodified>Fri, 09 Aug 2024 11:53:42 GMT</d:getlastmodified><oc:permissions>RGDNVCK</oc:permissions><oc:owner-display-name>Mara Jade</oc:owner-display-name></d:prop><d:status>HTTP/1.1 200 OK</d:status></d:propstat><d:propstat><d:prop><d:getcontenttype/></d:prop><d:status>HTTP/1.1 404 Not Found</d:status></d:propstat></d:response><d:response><d:href>/remote.php/dav/files/[email protected]/Folder/</d:href><d:propstat><d:prop><oc:fileid>555</oc:fileid><oc:size>232167</oc:size><d:getlastmodified>Fri, 09 Aug 2024 11:53:42 GMT</d:getlastmodified><oc:permissions>RGDNVCK</oc:permissions><oc:owner-display-name>Mara Jade</oc:owner-display-name></d:prop><d:status>HTTP/1.1 200 OK</d:status></d:propstat><d:propstat><d:prop><d:getcontenttype/></d:prop><d:status>HTTP/1.1 404 Not Found</d:status></d:propstat></d:response><d:response><d:href>/remote.php/dav/files/[email protected]/Folder%20with%20spaces/</d:href><d:propstat><d:prop><oc:fileid>561</oc:fileid><oc:size>890</oc:size><d:getlastmodified>Fri, 09 Aug 2024 11:52:09 GMT</d:getlastmodified><oc:permissions>RGDNVCK</oc:permissions><oc:owner-display-name>Mara Jade</oc:owner-display-name></d:prop><d:status>HTTP/1.1 200 OK</d:status></d:propstat><d:propstat><d:prop><d:getcontenttype/></d:prop><d:status>HTTP/1.1 404 Not Found</d:status></d:propstat></d:response><d:response><d:href>/remote.php/dav/files/[email protected]/%c3%9cml%c3%a6%c3%bbts/</d:href><d:propstat><d:prop><oc:fileid>562</oc:fileid><oc:size>19720</oc:size><d:getlastmodified>Fri, 09 Aug 2024 11:51:48 GMT</d:getlastmodified><oc:permissions>RGDNVCK</oc:permissions><oc:owner-display-name>Mara Jade</oc:owner-display-name></d:prop><d:status>HTTP/1.1 200 OK</d:status></d:propstat><d:propstat><d:prop><d:getcontenttype/></d:prop><d:status>HTTP/1.1 404 Not Found</d:status></d:propstat></d:response></d:multistatus>
+ recorded_at: Fri, 09 Aug 2024 12:11:50 GMT
recorded_with: VCR 6.2.0
diff --git a/modules/storages/spec/support/fixtures/vcr_cassettes/nextcloud/files_query_umlauts.yml b/modules/storages/spec/support/fixtures/vcr_cassettes/nextcloud/files_query_umlauts.yml
new file mode 100644
index 00000000000..5b82aecb99c
--- /dev/null
+++ b/modules/storages/spec/support/fixtures/vcr_cassettes/nextcloud/files_query_umlauts.yml
@@ -0,0 +1,102 @@
+---
+http_interactions:
+- request:
+ method: propfind
+ uri: https://nextcloud.local/remote.php/dav/files/[email protected]/%C3%9Cml%C3%A6%C3%BBts
+ body:
+ encoding: UTF-8
+ string: |
+ <?xml version="1.0"?>
+ <d:propfind xmlns:d="DAV:" xmlns:oc="http://owncloud.org/ns">
+ <d:prop>
+ <oc:fileid/>
+ <oc:size/>
+ <d:getcontenttype/>
+ <d:getlastmodified/>
+ <oc:permissions/>
+ <oc:owner-display-name/>
+ </d:prop>
+ </d:propfind>
+ headers:
+ Depth:
+ - '1'
+ Authorization:
+ - Bearer <BEARER TOKEN>
+ User-Agent:
+ - httpx.rb/1.3.0
+ Accept:
+ - "*/*"
+ Accept-Encoding:
+ - gzip, deflate
+ Content-Type:
+ - application/xml; charset=utf-8
+ Content-Length:
+ - '253'
+ response:
+ status:
+ code: 207
+ message: Multi-Status
+ headers:
+ Cache-Control:
+ - no-store, no-cache, must-revalidate
+ Content-Encoding:
+ - gzip
+ Content-Security-Policy:
+ - default-src 'none';
+ Content-Type:
+ - application/xml; charset=utf-8
+ Date:
+ - Fri, 09 Aug 2024 12:11:51 GMT
+ Dav:
+ - 1, 3, extended-mkcol, access-control, calendarserver-principal-property-search,
+ nextcloud-checksum-update, nc-calendar-search, nc-enable-birthday-calendar
+ Expires:
+ - Thu, 19 Nov 1981 08:52:00 GMT
+ Pragma:
+ - no-cache
+ Referrer-Policy:
+ - no-referrer
+ Server:
+ - Apache/2.4.59 (Debian)
+ Set-Cookie:
+ - oc07ul6b4oaw=fca8235be5541aa21fe6450f5fb0e7ed; path=/; secure; HttpOnly; SameSite=Lax,
+ oc_sessionPassphrase=GPlneLEHjF54IUs5NxS%2FIm8KtVawwtgqF8IvsCvOrbhpSjeoFunsmpijt%2BCQUu0QU7bcCyUZ9TAUronB9UVYNt2Ds12RcrIKupXD4iI80KIaO9IgNLs6VY3mJUYYizVR;
+ path=/; secure; HttpOnly; SameSite=Lax, oc07ul6b4oaw=fca8235be5541aa21fe6450f5fb0e7ed;
+ path=/; secure; HttpOnly; SameSite=Lax, __Host-nc_sameSiteCookielax=true;
+ path=/; httponly;secure; expires=Fri, 31-Dec-2100 23:59:59 GMT; SameSite=lax,
+ __Host-nc_sameSiteCookiestrict=true; path=/; httponly;secure; expires=Fri,
+ 31-Dec-2100 23:59:59 GMT; SameSite=strict, oc07ul6b4oaw=fca8235be5541aa21fe6450f5fb0e7ed;
+ path=/; secure; HttpOnly; SameSite=Lax, oc07ul6b4oaw=fca8235be5541aa21fe6450f5fb0e7ed;
+ path=/; secure; HttpOnly; SameSite=Lax, oc07ul6b4oaw=fca8235be5541aa21fe6450f5fb0e7ed;
+ path=/; secure; HttpOnly; SameSite=Lax, oc07ul6b4oaw=fca8235be5541aa21fe6450f5fb0e7ed;
+ path=/; secure; HttpOnly; SameSite=Lax, oc07ul6b4oaw=fca8235be5541aa21fe6450f5fb0e7ed;
+ path=/; secure; HttpOnly; SameSite=Lax, oc07ul6b4oaw=fca8235be5541aa21fe6450f5fb0e7ed;
+ path=/; secure; HttpOnly; SameSite=Lax, oc07ul6b4oaw=fca8235be5541aa21fe6450f5fb0e7ed;
+ path=/; secure; HttpOnly; SameSite=Lax
+ Vary:
+ - Brief,Prefer
+ X-Content-Type-Options:
+ - nosniff
+ X-Debug-Token:
+ - 175VkMCo6vZe9ftbYp8b
+ X-Frame-Options:
+ - SAMEORIGIN
+ X-Permitted-Cross-Domain-Policies:
+ - none
+ X-Powered-By:
+ - PHP/8.2.21
+ X-Request-Id:
+ - 175VkMCo6vZe9ftbYp8b
+ X-Robots-Tag:
+ - noindex, nofollow
+ X-Xss-Protection:
+ - 1; mode=block
+ Content-Length:
+ - '506'
+ body:
+ encoding: UTF-8
+ string: |
+ <?xml version="1.0"?>
+ <d:multistatus xmlns:d="DAV:" xmlns:s="http://sabredav.org/ns" xmlns:oc="http://owncloud.org/ns" xmlns:nc="http://nextcloud.org/ns"><d:response><d:href>/remote.php/dav/files/[email protected]/%c3%9cml%c3%a6%c3%bbts/</d:href><d:propstat><d:prop><oc:fileid>562</oc:fileid><oc:size>19720</oc:size><d:getlastmodified>Fri, 09 Aug 2024 11:51:48 GMT</d:getlastmodified><oc:permissions>RGDNVCK</oc:permissions><oc:owner-display-name>Mara Jade</oc:owner-display-name></d:prop><d:status>HTTP/1.1 200 OK</d:status></d:propstat><d:propstat><d:prop><d:getcontenttype/></d:prop><d:status>HTTP/1.1 404 Not Found</d:status></d:propstat></d:response><d:response><d:href>/remote.php/dav/files/[email protected]/%c3%9cml%c3%a6%c3%bbts/Anr%c3%bcchiges%20deutsches%20Dokument.docx</d:href><d:propstat><d:prop><oc:fileid>564</oc:fileid><oc:size>19720</oc:size><d:getcontenttype>application/vnd.openxmlformats-officedocument.wordprocessingml.document</d:getcontenttype><d:getlastmodified>Fri, 09 Aug 2024 11:51:40 GMT</d:getlastmodified><oc:permissions>RGDNVW</oc:permissions><oc:owner-display-name>Mara Jade</oc:owner-display-name></d:prop><d:status>HTTP/1.1 200 OK</d:status></d:propstat></d:response><d:response><d:href>/remote.php/dav/files/[email protected]/%c3%9cml%c3%a6%c3%bbts/data/</d:href><d:propstat><d:prop><oc:fileid>563</oc:fileid><oc:size>0</oc:size><d:getlastmodified>Fri, 09 Aug 2024 11:51:30 GMT</d:getlastmodified><oc:permissions>RGDNVCK</oc:permissions><oc:owner-display-name>Mara Jade</oc:owner-display-name></d:prop><d:status>HTTP/1.1 200 OK</d:status></d:propstat><d:propstat><d:prop><d:getcontenttype/></d:prop><d:status>HTTP/1.1 404 Not Found</d:status></d:propstat></d:response></d:multistatus>
+ recorded_at: Fri, 09 Aug 2024 12:11:51 GMT
+recorded_with: VCR 6.2.0
diff --git a/modules/storages/spec/support/shared_examples_for_adapters/files_query_examples.rb b/modules/storages/spec/support/shared_examples_for_adapters/files_query_examples.rb
new file mode 100644
index 00000000000..4abb3edad1a
--- /dev/null
+++ b/modules/storages/spec/support/shared_examples_for_adapters/files_query_examples.rb
@@ -0,0 +1,97 @@
+# frozen_string_literal: true
+
+#-- copyright
+# OpenProject is an open source project management software.
+# Copyright (C) 2012-2024 the OpenProject GmbH
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License version 3.
+#
+# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:
+# Copyright (C) 2006-2013 Jean-Philippe Lang
+# Copyright (C) 2010-2013 the ChiliProject Team
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# See COPYRIGHT and LICENSE files for more details.
+#++
+
+RSpec.shared_examples_for "files_query: basic query setup" do
+ it "is registered as queries.files" do
+ expect(Storages::Peripherals::Registry
+ .resolve("#{storage.short_provider_type}.queries.files")).to eq(described_class)
+ end
+
+ it "responds to #call with correct parameters" do
+ expect(described_class).to respond_to(:call)
+
+ method = described_class.method(:call)
+ expect(method.parameters).to contain_exactly(%i[keyreq storage],
+ %i[keyreq auth_strategy],
+ %i[keyreq folder])
+ end
+end
+
+RSpec.shared_examples_for "files_query: successful files response" do
+ it "returns a file info object" do
+ result = described_class.call(storage:, auth_strategy:, folder:)
+
+ expect(result).to be_success
+
+ response = result.result
+ expect(response).to be_a(Storages::StorageFiles)
+ expect(response).to eq(files_result)
+ end
+end
+
+RSpec.shared_examples_for "files_query: not found" do
+ it "returns a failure" do
+ result = described_class.call(storage:, auth_strategy:, folder:)
+
+ expect(result).to be_failure
+
+ error = result.errors
+ expect(error.code).to eq(:not_found)
+ expect(error.data.source).to eq(error_source)
+ end
+end
+
+RSpec.shared_examples_for "files_query: error" do
+ it "returns a failure" do
+ result = described_class.call(storage:, auth_strategy:, folder:)
+
+ expect(result).to be_failure
+
+ error = result.errors
+ expect(error.code).to eq(:error)
+ expect(error.data.source).to eq(error_source)
+ end
+end
+
+RSpec.shared_examples_for "files_query: validating input data" do
+ let(:error_source) { described_class }
+
+ context "if folder is no parent folder object" do
+ let(:folder) { "/root" }
+
+ it_behaves_like "files_query: error"
+ end
+
+ context "if folder path is nil" do
+ let(:folder) { nil }
+
+ it_behaves_like "files_query: error"
+ end
+end