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
[#50543] Failing GRAPH API call leads to rails exception
Eric Schubertc4b4a2030b1a
diff --git a/modules/storages/app/common/storages/peripherals/storage_interaction/nextcloud.rb b/modules/storages/app/common/storages/peripherals/storage_interaction/nextcloud.rbindex 1ca2ebd3c0c..30a194b19cd 100644--- a/modules/storages/app/common/storages/peripherals/storage_interaction/nextcloud.rb+++ b/modules/storages/app/common/storages/peripherals/storage_interaction/nextcloud.rb@@ -43,7 +43,8 @@ module Storagesregister(:propfind, Internal::PropfindQuery)register(:group_users, GroupUsersQuery)register(:upload_link, UploadLinkQuery)- register(:open_link, OpenLinkQuery)+ register(:open_file_link, OpenFileLinkQuery)+ register(:open_storage, OpenStorageQuery)endenddiff --git a/modules/storages/app/common/storages/peripherals/storage_interaction/nextcloud/open_link_query.rb b/modules/storages/app/common/storages/peripherals/storage_interaction/nextcloud/open_file_link_query.rbsimilarity index 98%rename from modules/storages/app/common/storages/peripherals/storage_interaction/nextcloud/open_link_query.rbrename to modules/storages/app/common/storages/peripherals/storage_interaction/nextcloud/open_file_link_query.rbindex 6c0b64c2ad3..6565de958f4 100644--- a/modules/storages/app/common/storages/peripherals/storage_interaction/nextcloud/open_link_query.rb+++ b/modules/storages/app/common/storages/peripherals/storage_interaction/nextcloud/open_file_link_query.rb@@ -32,7 +32,7 @@ module Storagesmodule Peripheralsmodule StorageInteractionmodule Nextcloud- class OpenLinkQuery+ class OpenFileLinkQuerydef initialize(storage)@uri = storage.urienddiff --git a/modules/storages/app/common/storages/peripherals/storage_interaction/nextcloud/open_storage_query.rb b/modules/storages/app/common/storages/peripherals/storage_interaction/nextcloud/open_storage_query.rbnew file mode 100644index 00000000000..a1fdd5803c6--- /dev/null+++ b/modules/storages/app/common/storages/peripherals/storage_interaction/nextcloud/open_storage_query.rb@@ -0,0 +1,54 @@+# frozen_string_literal: true++#-- copyright+# OpenProject is an open source project management software.+# Copyright (C) 2012-2023 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.+#++++module Storages+ module Peripherals+ module StorageInteraction+ module Nextcloud+ class OpenStorageQuery+ def initialize(storage)+ @uri = storage.uri+ end++ def self.call(storage:, user:)+ new(storage).call(user:)+ end++ # rubocop:disable Lint/UnusedMethodArgument+ def call(user:)+ ServiceResult.success(result: File.join(@uri.to_s, 'index.php/apps/files'))+ end++ # rubocop:enable Lint/UnusedMethodArgument+ end+ end+ end+ end+enddiff --git a/modules/storages/app/common/storages/peripherals/storage_interaction/one_drive.rb b/modules/storages/app/common/storages/peripherals/storage_interaction/one_drive.rbindex 1d05a7b59d0..2b7d449e745 100644--- a/modules/storages/app/common/storages/peripherals/storage_interaction/one_drive.rb+++ b/modules/storages/app/common/storages/peripherals/storage_interaction/one_drive.rb@@ -38,8 +38,8 @@ module Storagesregister(:files, FilesQuery)register(:file_info, FileInfoQuery)register(:files_info, FilesInfoQuery)- register(:open_link, OpenLinkQuery)- register(:open_drive_link, OpenDriveLinkQuery)+ register(:open_file_link, OpenFileLinkQuery)+ register(:open_storage, OpenStorageQuery)register(:upload_link, UploadLinkQuery)endenddiff --git a/modules/storages/app/common/storages/peripherals/storage_interaction/one_drive/files_info_query.rb b/modules/storages/app/common/storages/peripherals/storage_interaction/one_drive/files_info_query.rbindex 4726eb267a7..acdaa8c3e54 100644--- a/modules/storages/app/common/storages/peripherals/storage_interaction/one_drive/files_info_query.rb+++ b/modules/storages/app/common/storages/peripherals/storage_interaction/one_drive/files_info_query.rb@@ -33,8 +33,6 @@ module Storagesmodule StorageInteractionmodule OneDriveclass FilesInfoQuery- include StorageErrorHelper-using ServiceResultRefinementsdef self.call(storage:, user:, file_ids: [])diff --git a/modules/storages/app/common/storages/peripherals/storage_interaction/one_drive/open_link_query.rb b/modules/storages/app/common/storages/peripherals/storage_interaction/one_drive/open_file_link_query.rbsimilarity index 98%rename from modules/storages/app/common/storages/peripherals/storage_interaction/one_drive/open_link_query.rbrename to modules/storages/app/common/storages/peripherals/storage_interaction/one_drive/open_file_link_query.rbindex 6c4c6413370..1c539ce39e7 100644--- a/modules/storages/app/common/storages/peripherals/storage_interaction/one_drive/open_link_query.rb+++ b/modules/storages/app/common/storages/peripherals/storage_interaction/one_drive/open_file_link_query.rb@@ -32,7 +32,7 @@ module Storagesmodule Peripheralsmodule StorageInteractionmodule OneDrive- class OpenLinkQuery+ class OpenFileLinkQueryusing ::Storages::Peripherals::ServiceResultRefinementsdef self.call(storage:, user:, file_id:, open_location: false)diff --git a/modules/storages/app/common/storages/peripherals/storage_interaction/one_drive/open_drive_link_query.rb b/modules/storages/app/common/storages/peripherals/storage_interaction/one_drive/open_storage_query.rbsimilarity index 88%rename from modules/storages/app/common/storages/peripherals/storage_interaction/one_drive/open_drive_link_query.rbrename to modules/storages/app/common/storages/peripherals/storage_interaction/one_drive/open_storage_query.rbindex 68d48ad46e9..57b6be0c419 100644--- a/modules/storages/app/common/storages/peripherals/storage_interaction/one_drive/open_drive_link_query.rb+++ b/modules/storages/app/common/storages/peripherals/storage_interaction/one_drive/open_storage_query.rb@@ -32,7 +32,7 @@ module Storagesmodule Peripheralsmodule StorageInteractionmodule OneDrive- class OpenDriveLinkQuery+ class OpenStorageQuerydef self.call(storage:, user:)new(storage).call(user:)end@@ -44,13 +44,13 @@ module Storagesdef call(user:)Util.using_user_token(@storage, user) do |token|- make_request(token).map(&web_url)+ request_drive(token).map(&web_url)endendprivate- def make_request(token)+ def request_drive(token)response_data = Net::HTTP.start(@uri.host, @uri.port, use_ssl: true) do |http|http.get(drive_uri_path, { 'Authorization' => "Bearer #{token.access_token}" })end@@ -60,22 +60,23 @@ module Storagesdef handle_responses(response)json = MultiJson.load(response.body, symbolize_keys: true)+ error_data = ::Storages::StorageErrorData.new(source: self, payload: json)case responsewhen Net::HTTPSuccessServiceResult.success(result: json)when Net::HTTPNotFoundServiceResult.failure(result: :not_found,- errors: ::Storages::StorageError.new(code: :not_found, data: json))+ errors: ::Storages::StorageError.new(code: :not_found, data: error_data))when Net::HTTPForbiddenServiceResult.failure(result: :forbidden,- errors: ::Storages::StorageError.new(code: :forbidden, data: json))+ errors: ::Storages::StorageError.new(code: :forbidden, data: error_data))when Net::HTTPUnauthorizedServiceResult.failure(result: :unauthorized,- errors: ::Storages::StorageError.new(code: :unauthorized, data: json))+ errors: ::Storages::StorageError.new(code: :unauthorized, data: error_data))elseServiceResult.failure(result: :error,- errors: ::Storages::StorageError.new(code: :error, data: json))+ errors: ::Storages::StorageError.new(code: :error, data: error_data))endenddiff --git a/modules/storages/app/models/storages/nextcloud_storage.rb b/modules/storages/app/models/storages/nextcloud_storage.rbindex c31f8810bba..06451b2beb7 100644--- a/modules/storages/app/models/storages/nextcloud_storage.rb+++ b/modules/storages/app/models/storages/nextcloud_storage.rb@@ -60,10 +60,6 @@ module StoragesPeripherals::OAuthConfigurations::NextcloudConfiguration.new(self)end- def open_link- File.join(uri.to_s, 'index.php/apps/files')- end-def automatic_management_unspecified?automatically_managed.nil?enddiff --git a/modules/storages/app/models/storages/one_drive_storage.rb b/modules/storages/app/models/storages/one_drive_storage.rbindex 7209f71061b..1d2e116cc32 100644--- a/modules/storages/app/models/storages/one_drive_storage.rb+++ b/modules/storages/app/models/storages/one_drive_storage.rb@@ -50,14 +50,5 @@ module Storagesdef connect_src%w[https://*.sharepoint.com https://*.up.1drv.com]end-- def open_link- ::Storages::Peripherals::Registry.resolve("queries.one_drive.open_drive_link")- .call(storage: self, user: User.current)- .match(- on_success: ->(web_url) { web_url },- on_failure: ->(*) { '' }- )- endendenddiff --git a/modules/storages/app/models/storages/project_storage.rb b/modules/storages/app/models/storages/project_storage.rbindex 24b544dccf5..b2405f97eb3 100644--- a/modules/storages/app/models/storages/project_storage.rb+++ b/modules/storages/app/models/storages/project_storage.rb@@ -64,19 +64,6 @@ class Storages::ProjectStorage < ApplicationRecordescaped_file_path.match?(%r|^/#{project_folder_path_escaped}|)end- def open_link- if project_folder_inactive?- storage.open_link- else- call = ::Storages::Peripherals::Registry.resolve("queries.#{storage.short_provider_type}.open_link")- .call(storage:, user: User.current, file_id: project_folder_id)- call.match(- on_success: ->(url) { url },- on_failure: ->(*) { storage.open_link }- )- end- end-privatedef escape_path(path)diff --git a/modules/storages/app/models/storages/storage.rb b/modules/storages/app/models/storages/storage.rbindex 72bd1f37f86..42c345a7736 100644--- a/modules/storages/app/models/storages/storage.rb+++ b/modules/storages/app/models/storages/storage.rb@@ -116,10 +116,6 @@ module Storages["#{uri.scheme}://#{uri.host}"]end- def open_link- raise Errors::SubclassResponsibility- end-def oauth_configurationraise Errors::SubclassResponsibilityenddiff --git a/modules/storages/lib/api/v3/file_links/file_links_open_api.rb b/modules/storages/lib/api/v3/file_links/file_links_open_api.rbindex e721ac5d4be..8b4a6d2f2fa 100644--- a/modules/storages/lib/api/v3/file_links/file_links_open_api.rb+++ b/modules/storages/lib/api/v3/file_links/file_links_open_api.rb@@ -27,12 +27,14 @@#++class API::V3::FileLinks::FileLinksOpenAPI < API::OpenProjectAPI+ helpers Storages::Peripherals::StorageErrorHelper+using Storages::Peripherals::ServiceResultRefinementsresources :open doget doStorages::Peripherals::Registry- .resolve("queries.#{@file_link.storage.short_provider_type}.open_link")+ .resolve("queries.#{@file_link.storage.short_provider_type}.open_file_link").call(storage: @file_link.storage,user: current_user,diff --git a/modules/storages/lib/api/v3/project_storages/project_storage_open_api.rb b/modules/storages/lib/api/v3/project_storages/project_storage_open_api.rbnew file mode 100644index 00000000000..b48d22f1bd9--- /dev/null+++ b/modules/storages/lib/api/v3/project_storages/project_storage_open_api.rb@@ -0,0 +1,62 @@+#-- copyright+# OpenProject is an open source project management software.+# Copyright (C) 2012-2023 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.+#++++class API::V3::ProjectStorages::ProjectStorageOpenAPI < API::OpenProjectAPI+ helpers Storages::Peripherals::StorageErrorHelper++ using Storages::Peripherals::ServiceResultRefinements++ resources :open do+ get do+ query_result = if @project_storage.project_folder_inactive?+ Storages::Peripherals::Registry+ .resolve("queries.#{@project_storage.storage.short_provider_type}.open_storage")+ .call(+ storage: @project_storage.storage,+ user: current_user+ )+ else+ Storages::Peripherals::Registry+ .resolve("queries.#{@project_storage.storage.short_provider_type}.open_file_link")+ .call(+ storage: @project_storage.storage,+ user: current_user,+ file_id: @project_storage.project_folder_id+ )+ end++ query_result.match(+ on_success: ->(url) do+ redirect url, body: "The requested resource can be viewed at #{url}"+ status 303+ end,+ on_failure: ->(error) { raise_error(error) }+ )+ end+ end+enddiff --git a/modules/storages/lib/api/v3/project_storages/project_storage_representer.rb b/modules/storages/lib/api/v3/project_storages/project_storage_representer.rbindex 3582a75628e..8795408722a 100644--- a/modules/storages/lib/api/v3/project_storages/project_storage_representer.rb+++ b/modules/storages/lib/api/v3/project_storages/project_storage_representer.rb@@ -46,6 +46,10 @@ module API::V3::ProjectStorages{ href: api_v3_paths.storage_file(represented.storage.id, represented.project_folder_id) }end+ link :open do+ { href: api_v3_paths.project_storage_open(represented.id) }+ end+associated_resource :storage, skip_render: ->(*) { true }, skip_link: ->(*) { false }associated_resource :project, skip_render: ->(*) { true }, skip_link: ->(*) { false }associated_resource :creator,diff --git a/modules/storages/lib/api/v3/project_storages/project_storages_api.rb b/modules/storages/lib/api/v3/project_storages/project_storages_api.rbindex a7393998e78..126461dc3e9 100644--- a/modules/storages/lib/api/v3/project_storages/project_storages_api.rb+++ b/modules/storages/lib/api/v3/project_storages/project_storages_api.rb@@ -63,6 +63,8 @@ module API::V3::ProjectStoragesendget &API::V3::Utilities::Endpoints::Show.new(model: Storages::ProjectStorage).mount++ mount API::V3::ProjectStorages::ProjectStorageOpenAPIendendenddiff --git a/modules/storages/lib/api/v3/storages/storage_open_api.rb b/modules/storages/lib/api/v3/storages/storage_open_api.rbnew file mode 100644index 00000000000..be0d7d2c34c--- /dev/null+++ b/modules/storages/lib/api/v3/storages/storage_open_api.rb@@ -0,0 +1,48 @@+#-- copyright+# OpenProject is an open source project management software.+# Copyright (C) 2012-2023 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.+#++++class API::V3::Storages::StorageOpenAPI < API::OpenProjectAPI+ helpers Storages::Peripherals::StorageErrorHelper++ using Storages::Peripherals::ServiceResultRefinements++ resources :open do+ get do+ Storages::Peripherals::Registry+ .resolve("queries.#{@storage.short_provider_type}.open_storage")+ .call(storage: @storage, user: current_user, file_id: nil)+ .match(+ on_success: ->(url) do+ redirect url, body: "The requested resource can be viewed at #{url}"+ status 303+ end,+ on_failure: ->(error) { raise_error(error) }+ )+ end+ end+enddiff --git a/modules/storages/lib/api/v3/storages/storage_representer.rb b/modules/storages/lib/api/v3/storages/storage_representer.rbindex f4877fc26b2..ebdd3886f9d 100644--- a/modules/storages/lib/api/v3/storages/storage_representer.rb+++ b/modules/storages/lib/api/v3/storages/storage_representer.rb@@ -151,7 +151,7 @@ module API::V3::Storagesendlink :open do- { href: represented.open_link }+ { href: api_v3_paths.storage_open(represented.id) }endlink :authorizationState dodiff --git a/modules/storages/lib/api/v3/storages/storages_api.rb b/modules/storages/lib/api/v3/storages/storages_api.rbindex 80e67610096..1032ca3ae8d 100644--- a/modules/storages/lib/api/v3/storages/storages_api.rb+++ b/modules/storages/lib/api/v3/storages/storages_api.rb@@ -49,6 +49,7 @@ class API::V3::Storages::StoragesAPI < API::OpenProjectAPImount API::V3::StorageFiles::StorageFilesAPImount API::V3::OAuthClient::OAuthClientCredentialsAPI+ mount API::V3::Storages::StorageOpenAPIendendenddiff --git a/modules/storages/lib/open_project/storages/engine.rb b/modules/storages/lib/open_project/storages/engine.rbindex 653bce0582e..b078b5748e9 100644--- a/modules/storages/lib/open_project/storages/engine.rb+++ b/modules/storages/lib/open_project/storages/engine.rb@@ -159,7 +159,7 @@ module OpenProject::StoragesUser.current.allowed_to?(:view_file_links, project)project.project_storages.each do |project_storage|storage = project_storage.storage- href = project_storage.open_link+ href = "/api/v3/project_storages/#{project_storage.id}/open"icon = if storage.provider_type_nextcloud?'nextcloud-circle'else@@ -228,13 +228,21 @@ module OpenProject::Storagesendadd_api_path :project_storage do |id|- "#{root}/project_storages/#{id}"+ "#{project_storages}/#{id}"+ end++ add_api_path :project_storage_open do |id|+ "#{project_storage(id)}/open"endadd_api_path :storage do |storage_id|"#{storages}/#{storage_id}"end+ add_api_path :storage_open do |storage_id|+ "#{storage(storage_id)}/open"+ end+add_api_path :storage_files do |storage_id|"#{storage(storage_id)}/files"enddiff --git a/modules/storages/spec/common/storages/peripherals/storage_interaction/nextcloud/open_link_query_spec.rb b/modules/storages/spec/common/storages/peripherals/storage_interaction/nextcloud/open_file_link_query_spec.rbsimilarity index 91%rename from modules/storages/spec/common/storages/peripherals/storage_interaction/nextcloud/open_link_query_spec.rbrename to modules/storages/spec/common/storages/peripherals/storage_interaction/nextcloud/open_file_link_query_spec.rbindex 365182befbb..a45f8d92193 100644--- a/modules/storages/spec/common/storages/peripherals/storage_interaction/nextcloud/open_link_query_spec.rb+++ b/modules/storages/spec/common/storages/peripherals/storage_interaction/nextcloud/open_file_link_query_spec.rb@@ -31,9 +31,7 @@require 'spec_helper'require_module_spec_helper-RSpec.describe Storages::Peripherals::StorageInteraction::Nextcloud::OpenLinkQuery do- include JsonResponseHelper-+RSpec.describe Storages::Peripherals::StorageInteraction::Nextcloud::OpenFileLinkQuery dolet(:storage) { create(:nextcloud_storage, host: 'https://example.com') }let(:user) { create(:user) }let(:file_id) { '1337' }@@ -45,6 +43,11 @@ RSpec.describe Storages::Peripherals::StorageInteraction::Nextcloud::OpenLinkQueexpect(method.parameters).to contain_exactly(%i[keyreq storage], %i[keyreq user], %i[keyreq file_id], %i[key open_location])end+ it 'returns the url for opening the storage if no file id is provided' do+ url = described_class.call(storage:, user:, file_id: nil).result+ expect(url).to eq("#{storage.host}/index.php/apps/files")+ end+it 'returns the url for opening the file on storage' dourl = described_class.call(storage:, user:, file_id:).resultexpect(url).to eq("#{storage.host}/index.php/f/#{file_id}?openfile=1")diff --git a/modules/storages/spec/common/storages/peripherals/storage_interaction/one_drive/download_link_query_spec.rb b/modules/storages/spec/common/storages/peripherals/storage_interaction/one_drive/download_link_query_spec.rbindex 5ecb40ba05b..034560550e9 100644--- a/modules/storages/spec/common/storages/peripherals/storage_interaction/one_drive/download_link_query_spec.rb+++ b/modules/storages/spec/common/storages/peripherals/storage_interaction/one_drive/download_link_query_spec.rb@@ -56,7 +56,7 @@ RSpec.describe Storages::Peripherals::StorageInteraction::OneDrive::DownloadLinkit 'return an error if any other response is received' dostub_request(:get, "https://graph.microsoft.com/v1.0/drives/#{storage.drive_id}/items/#{file_link.origin_id}/content").with(headers: { 'Authorization' => "Bearer #{token.access_token}" })- .and_return(status: 200, body: "")+ .and_return(status: 200, body: '')download_link = download_link_query.call(user:, file_link:)diff --git a/modules/storages/spec/common/storages/peripherals/storage_interaction/one_drive/open_link_query_spec.rb b/modules/storages/spec/common/storages/peripherals/storage_interaction/one_drive/open_file_link_query_spec.rbsimilarity index 99%rename from modules/storages/spec/common/storages/peripherals/storage_interaction/one_drive/open_link_query_spec.rbrename to modules/storages/spec/common/storages/peripherals/storage_interaction/one_drive/open_file_link_query_spec.rbindex 0c0786e52d5..943649571fd 100644--- a/modules/storages/spec/common/storages/peripherals/storage_interaction/one_drive/open_link_query_spec.rb+++ b/modules/storages/spec/common/storages/peripherals/storage_interaction/one_drive/open_file_link_query_spec.rb@@ -31,7 +31,7 @@require 'spec_helper'require_module_spec_helper-RSpec.describe Storages::Peripherals::StorageInteraction::OneDrive::OpenLinkQuery, :webmock do+RSpec.describe Storages::Peripherals::StorageInteraction::OneDrive::OpenFileLinkQuery, :webmock doinclude JsonResponseHelperlet(:storage) dodiff --git a/modules/storages/spec/common/storages/peripherals/storage_interaction/one_drive/open_drive_link_query_spec.rb b/modules/storages/spec/common/storages/peripherals/storage_interaction/one_drive/open_storage_query_spec.rbsimilarity index 93%rename from modules/storages/spec/common/storages/peripherals/storage_interaction/one_drive/open_drive_link_query_spec.rbrename to modules/storages/spec/common/storages/peripherals/storage_interaction/one_drive/open_storage_query_spec.rbindex 5dfaf831295..e1011ba9f7f 100644--- a/modules/storages/spec/common/storages/peripherals/storage_interaction/one_drive/open_drive_link_query_spec.rb+++ b/modules/storages/spec/common/storages/peripherals/storage_interaction/one_drive/open_storage_query_spec.rb@@ -31,9 +31,11 @@require 'spec_helper'require_module_spec_helper-RSpec.describe Storages::Peripherals::StorageInteraction::OneDrive::OpenDriveLinkQuery, :webmock do+RSpec.describe Storages::Peripherals::StorageInteraction::OneDrive::OpenStorageQuery, :webmock doinclude JsonResponseHelper+ using Storages::Peripherals::ServiceResultRefinements+let(:storage) docreate(:one_drive_storage,:with_oauth_client,@@ -70,7 +72,7 @@ RSpec.describe Storages::Peripherals::StorageInteraction::OneDrive::OpenDriveLinexpect(open_drive_link_result).to be_failureexpect(open_drive_link_result.result).to eq(:not_found)- expect(open_drive_link_result.errors.data.to_json).to eq(not_found_json)+ expect(open_drive_link_result.error_payload.to_json).to eq(not_found_json)endit 'returns a forbidden error if the API call returns a 403' do@@ -82,7 +84,7 @@ RSpec.describe Storages::Peripherals::StorageInteraction::OneDrive::OpenDriveLinexpect(open_drive_link_result).to be_failureexpect(open_drive_link_result.result).to eq(:forbidden)- expect(open_drive_link_result.errors.data.to_json).to eq(forbidden_json)+ expect(open_drive_link_result.error_payload.to_json).to eq(forbidden_json)endendenddiff --git a/modules/storages/spec/features/storages_menu_links_spec.rb b/modules/storages/spec/features/storages_menu_links_spec.rbindex fc21cfa2d08..48a8bd89c56 100644--- a/modules/storages/spec/features/storages_menu_links_spec.rb+++ b/modules/storages/spec/features/storages_menu_links_spec.rb@@ -56,10 +56,10 @@ RSpec.describe 'Project menu', :js, :with_cuprite doit 'has links to enabled storages' dovisit(project_path(id: project.id))- expect(page).to have_link(storage.name, href: storage.open_link)- project_folder_id = project_storage_with_manual_folder.project_folder_id- folder_href = "#{another_storage.host}/index.php/f/#{project_folder_id}?openfile=1"- expect(page).to have_link(another_storage.name, href: folder_href)+ expect(page).to have_link(storage.name,+ href: api_v3_paths.project_storage_open(project_storage_without_folder.id))+ expect(page).to have_link(another_storage.name,+ href: api_v3_paths.project_storage_open(project_storage_with_manual_folder.id))expect(page).not_to have_link(unlinked_storage.name)end@@ -69,11 +69,10 @@ RSpec.describe 'Project menu', :js, :with_cuprite doit 'has no links to enabled storage' dovisit(project_path(id: project.id))- expect(page).not_to have_link(storage.name, href: storage.open_link)- project_folder_id = project_storage_with_manual_folder.project_folder_id- folder_href = "#{another_storage.host}/index.php/f/#{project_folder_id}?openfile=1"- expect(page).not_to have_link(another_storage.name, href: folder_href)- expect(page).not_to have_link(another_storage.name, href: another_storage.open_link)+ expect(page).not_to have_link(storage.name,+ href: api_v3_paths.project_storage_open(project_storage_without_folder.id))+ expect(page).not_to have_link(another_storage.name,+ href: api_v3_paths.project_storage_open(project_storage_with_manual_folder.id))expect(page).not_to have_link(unlinked_storage.name)endenddiff --git a/modules/storages/spec/lib/api/v3/storages/storages_representer_rendering_spec.rb b/modules/storages/spec/lib/api/v3/storages/storages_representer_rendering_spec.rbindex b3961557933..4217000cc11 100644--- a/modules/storages/spec/lib/api/v3/storages/storages_representer_rendering_spec.rb+++ b/modules/storages/spec/lib/api/v3/storages/storages_representer_rendering_spec.rb@@ -276,7 +276,7 @@ RSpec.describe API::V3::Storages::StorageRepresenter, 'rendering' doendbefore do- Storages::Peripherals::Registry.stub('queries.one_drive.open_drive_link', ->(_) do+ Storages::Peripherals::Registry.stub('queries.one_drive.open_storage', ->(_) doServiceResult.success(result: 'https://my.sharepoint.com/sites/DeathStar/Documents')end)end