From 80a670e1f1949ccc759433addf1cf475ac280689 Mon Sep 17 00:00:00 2001 From: Pavel Balashou Date: Mon, 18 Dec 2023 20:43:51 +0100 Subject: [PATCH] Fix file_info_query and delete_entity_command. --- .../storage_interaction/nextcloud/file_info_query.rb | 12 ++++-------- .../nextcloud/internal/delete_entity_command.rb | 5 +++-- 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/modules/storages/app/common/storages/peripherals/storage_interaction/nextcloud/file_info_query.rb b/modules/storages/app/common/storages/peripherals/storage_interaction/nextcloud/file_info_query.rb index 3f1a544c640e..9716db0819c5 100644 --- a/modules/storages/app/common/storages/peripherals/storage_interaction/nextcloud/file_info_query.rb +++ b/modules/storages/app/common/storages/peripherals/storage_interaction/nextcloud/file_info_query.rb @@ -54,14 +54,10 @@ def call(user:, file_id:) def file_info(file_id, token) response = Util .httpx - .get( - Util.join_uri_path(@uri, FILE_INFO_PATH, file_id), - { - 'Authorization' => "Bearer #{token.access_token}", - 'Accept' => 'application/json', - 'OCS-APIRequest' => 'true' - } - ) + .with(headers: { 'Authorization' => "Bearer #{token.access_token}", + 'Accept' => 'application/json', + 'OCS-APIRequest' => 'true' }) + .get(Util.join_uri_path(@uri, FILE_INFO_PATH, file_id)) case response.status when 200 diff --git a/modules/storages/app/common/storages/peripherals/storage_interaction/nextcloud/internal/delete_entity_command.rb b/modules/storages/app/common/storages/peripherals/storage_interaction/nextcloud/internal/delete_entity_command.rb index b2a65fdd6333..c2be065d34aa 100644 --- a/modules/storages/app/common/storages/peripherals/storage_interaction/nextcloud/internal/delete_entity_command.rb +++ b/modules/storages/app/common/storages/peripherals/storage_interaction/nextcloud/internal/delete_entity_command.rb @@ -32,7 +32,6 @@ class DeleteEntityCommand def initialize(storage) @uri = storage.uri - @base_path = @username = storage.username @password = storage.password end @@ -45,7 +44,9 @@ def call(location:) response = UTIL .httpx .basic_auth(@username, @password) - .delete(UTIL.join_uri_path(@uri, "remote.php/dav/files", CGI.escapeURIComponent(@username), UTIL.escape_path(location))) + .delete(UTIL.join_uri_path(@uri, "remote.php/dav/files", + CGI.escapeURIComponent(@username), + UTIL.escape_path(location))) case response.status when 204