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

UploadLinkQuery for SharePoint

Marcello Rocha949ac9027fc9
diff --git a/modules/storages/app/common/storages/adapters/authentication.rb b/modules/storages/app/common/storages/adapters/authentication.rb
index 49bf6431446..f609bdf00a9 100644
--- a/modules/storages/app/common/storages/adapters/authentication.rb
+++ b/modules/storages/app/common/storages/adapters/authentication.rb
@@ -36,7 +36,7 @@ module Storages
# @return [AuthenticationStrategy]
# rubocop:disable Metrics/AbcSize
def [](strategy)
- auth = strategy.value_or { |it| raise ArgumentError, "Invalid authentication strategy '#{it.inspect}'" }
+ auth = strategy.value_or { raise ArgumentError, "Invalid authentication strategy '#{it.inspect}'" }
case auth.key
when :noop
diff --git a/modules/storages/app/common/storages/adapters/providers/share_point/queries/upload_link_query.rb b/modules/storages/app/common/storages/adapters/providers/share_point/queries/upload_link_query.rb
new file mode 100644
index 00000000000..ae6482e5b65
--- /dev/null
+++ b/modules/storages/app/common/storages/adapters/providers/share_point/queries/upload_link_query.rb
@@ -0,0 +1,99 @@
+# frozen_string_literal: true
+
+#-- copyright
+# OpenProject is an open source project management software.
+# Copyright (C) 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 Adapters
+ module Providers
+ module SharePoint
+ module Queries
+ class UploadLinkQuery < Base
+ def call(auth_strategy:, input_data:)
+ with_tagged_logger do
+ Authentication[auth_strategy].call(storage: @storage) do |http|
+ info "Requesting an upload link on folder #{input_data.folder_id}"
+ handle_response(
+ http.post(request_uri(input_data.folder_id, input_data.file_name), json: payload(input_data.file_name))
+ )
+ end
+ end
+ end
+
+ private
+
+ def payload(filename)
+ { item: { "@microsoft.graph.conflictBehavior" => "rename", name: filename } }
+ end
+
+ # rubocop:disable Metrics/AbcSize
+ def handle_response(response)
+ error = Results::Error.new(source: self.class, payload: response)
+
+ case response
+ in { status: 200..299 }
+ upload_url = response.json(symbolize_keys: true)[:uploadUrl]
+ info "Upload link generated successfully."
+ Results::UploadLink.build(destination: upload_url, method: :put)
+ in { status: 404 | 400 } # not existent parent folder in request url is responded with 400
+ info "The parent folder was not found."
+ Failure(error.with(code: :not_found))
+ in { status: 401 }
+ info "User authorization failed."
+ Failure(error.with(code: :unauthorized))
+ in { status: 403 }
+ info "User authorization failed."
+ Failure(error.with(code: :forbidden))
+ else
+ info "Unknown error happened."
+ Failure(error.with(code: :error))
+ end
+ end
+ # rubocop:enable Metrics/AbcSize
+
+ def request_uri(folder, filename)
+ split_identifier(folder) => { drive_id:, location: }
+ base = location.root? ? root_url(drive_id) : item_url(drive_id, location)
+ file_path = UrlBuilder.path(filename)
+
+ "#{base}:#{file_path}:/createUploadSession"
+ end
+
+ def root_url(drive_id)
+ UrlBuilder.url(base_uri, "/v1.0/drives", drive_id, "/items/root")
+ end
+
+ def item_url(drive_id, location)
+ UrlBuilder.url(base_uri, "/v1.0/drives", drive_id, "/items", location.path)
+ end
+ end
+ end
+ end
+ end
+ end
+end
diff --git a/modules/storages/app/common/storages/adapters/providers/share_point/share_point_registry.rb b/modules/storages/app/common/storages/adapters/providers/share_point/share_point_registry.rb
index 2c7d58ae67c..6ea602473df 100644
--- a/modules/storages/app/common/storages/adapters/providers/share_point/share_point_registry.rb
+++ b/modules/storages/app/common/storages/adapters/providers/share_point/share_point_registry.rb
@@ -70,6 +70,7 @@ module Storages
namespace("queries") do
register(:files, Queries::FilesQuery)
+ register(:upload_link, Queries::UploadLinkQuery)
register(:user, OneDrive::Queries::UserQuery)
end
end
diff --git a/modules/storages/app/common/storages/adapters/results/upload_link.rb b/modules/storages/app/common/storages/adapters/results/upload_link.rb
index f8d51deaa45..7f4b0f09e59 100644
--- a/modules/storages/app/common/storages/adapters/results/upload_link.rb
+++ b/modules/storages/app/common/storages/adapters/results/upload_link.rb
@@ -36,10 +36,7 @@ module Storages
private_class_method :new
def self.build(destination:, method:, contract: UploadLinkContract.new)
- contract.call(destination:, method:).to_monad.fmap do |it|
- params = it.to_h
- new(URI(params[:destination]), params[:method])
- end
+ contract.call(destination: URI(destination), method:).to_monad.fmap { new(**it.to_h) }
end
end
end
diff --git a/modules/storages/spec/common/storages/adapters/providers/share_point/queries/upload_link_query_spec.rb b/modules/storages/spec/common/storages/adapters/providers/share_point/queries/upload_link_query_spec.rb
new file mode 100644
index 00000000000..d49c5e13f3d
--- /dev/null
+++ b/modules/storages/spec/common/storages/adapters/providers/share_point/queries/upload_link_query_spec.rb
@@ -0,0 +1,114 @@
+# frozen_string_literal: true
+
+#-- copyright
+# OpenProject is an open source project management software.
+# Copyright (C) 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.
+#++
+
+require "spec_helper"
+require_module_spec_helper
+
+module Storages
+ module Adapters
+ module Providers
+ module SharePoint
+ module Queries
+ RSpec.describe UploadLinkQuery, :webmock do
+ let(:storage) { create(:share_point_storage, :sandbox) }
+ let(:auth_strategy) { Registry["share_point.authentication.userless"].call }
+ let(:upload_method) { :put }
+ let(:input_data) { Input::UploadLink.build(folder_id:, file_name:).value! }
+ let(:file_name) { "DeathStart_blueprints.tiff" }
+
+ it_behaves_like "adapter upload_link_query: basic query setup"
+
+ context "when creating an upload link to the root folder of a list", vcr: "share_point/upload_link_success" do
+ let(:folder_id) { "b!FeOZEMfQx0eGQKqVBLcP__BG8mq-4-9FuRqOyk3MXY8Qconfm2i6SKEoCmuGYqQK" }
+
+ let(:token) do
+ "v1.eyJzaXRlaWQiOiIxMDk5ZTMxNS1kMGM3LTQ3YzctODY0MC1hYTk1MDRiNzBmZmYiLCJhcHBfZGlzcGxheW5hbWUiOiJPUCBTZ" \
+ "WxlY3RlZCIsIm5hbWVpZCI6IjQwNGUwNTY3LTE5YTEtNGE2NC1iMmQxLWQzYjBjOTlmMmVkOUBlMzZmMWRiYy1mZGFlLTQyN2UtYj" \
+ "YxYi0wZDk2ZGRmYjgxYTQiLCJhdWQiOiIwMDAwMDAwMy0wMDAwLTBmZjEtY2UwMC0wMDAwMDAwMDAwMDAveW10NmQuc2hhcmVwb2l" \
+ "udC5jb21AZTM2ZjFkYmMtZmRhZS00MjdlLWI2MWItMGQ5NmRkZmI4MWE0IiwiZXhwIjoiMTc1NDk5NTA4NSJ9.CkAKDGVudHJhX2N" \
+ "sYWltcxIwQ09DTjU4UUdFQUFhRmt4TWEwZHlNV3R5ZDJ0MVN6WmFiemxwYkhCbVFVRXFBQT09CjIKCmFjdG9yYXBwaWQSJDAwMDAw" \
+ "MDAzLTAwMDAtMDAwMC1jMDAwLTAwMDAwMDAwMDAwMAoKCgRzbmlkEgI2NhILCKa2j4Kms6w-EAUaDjIwLjE5MC4xOTAuMTAwKixhM" \
+ "1l1blg1YkN6MFBCVjM3S2RGblA1QWdyL08wYllnS0FIeU1rU3Rvam1jPTCBAjgBQhChuq4krFAAAHqMwh13MKvaShBoYXNoZWRwcm" \
+ "9vZnRva2VuegExugENc2VsZWN0ZWRzaXRlc8gBAQ._udXSV3Fv81Ws1n5RdRe3aKpVRVZIewLPNiHh8CVjy0"
+ end
+
+ let(:upload_url) do
+ "https://ymt6d.sharepoint.com/sites/OPTest/_api/v2.0/drives/" \
+ "b!FeOZEMfQx0eGQKqVBLcP__BG8mq-4-9FuRqOyk3MXY8Qconfm2i6SKEoCmuGYqQK/items/01ANJ53WYPWYGIOMO3WFGK2YENXB7ESIS5" \
+ "/uploadSession?guid=%275fa68ee0-d944-4323-817a-2bf0ece08ae5%27&overwrite=False&rename=True&dc=0&tempa" \
+ "uth=#{token}"
+ end
+
+ it_behaves_like "adapter upload_link_query: successful upload link response"
+ end
+
+ context "when creating an upload link to a subfolder on a list", vcr: "share_point/upload_link_subfolder" do
+ let(:folder_id) do
+ "b!FeOZEMfQx0eGQKqVBLcP__BG8mq-4-9FuRqOyk3MXY9jo6leJDqrT7muzvmiWjFW||01ANJ53W5P3SUY3ZCDTRA3KLXRGA5A2M3S"
+ end
+ let(:token) do
+ "v1.eyJzaXRlaWQiOiIxMDk5ZTMxNS1kMGM3LTQ3YzctODY0MC1hYTk1MDRiNzBmZmYiLCJhcHBfZGlzcGxheW5hbWUiOiJPUCBTZWx" \
+ "lY3RlZCIsIm5hbWVpZCI6IjQwNGUwNTY3LTE5YTEtNGE2NC1iMmQxLWQzYjBjOTlmMmVkOUBlMzZmMWRiYy1mZGFlLTQyN2UtYjYx" \
+ "Yi0wZDk2ZGRmYjgxYTQiLCJhdWQiOiIwMDAwMDAwMy0wMDAwLTBmZjEtY2UwMC0wMDAwMDAwMDAwMDAveW10NmQuc2hhcmVwb2lud" \
+ "C5jb21AZTM2ZjFkYmMtZmRhZS00MjdlLWI2MWItMGQ5NmRkZmI4MWE0IiwiZXhwIjoiMTc1NTA5MDQ5OSJ9.CkAKDGVudHJhX2NsY" \
+ "WltcxIwQ0piMzdNUUdFQUFhRmpKMU16bElUalJHTFZVeVJWQm9OblpPTmpSUlFVRXFBQT09CjIKCmFjdG9yYXBwaWQSJDAwMDAwMD" \
+ "AzLTAwMDAtMDAwMC1jMDAwLTAwMDAwMDAwMDAwMAoKCgRzbmlkEgI2NhILCI7l0_Dq6qw-EAUaDjIwLjE5MC4xOTAuMTAyKixZYld" \
+ "pRDFScDM5SGNsREo0dXQrck5xUjJjelRwbmgya3lSZlhWVnVaZnVBPTCBAjgBQhChuwki92AAAHU0wDr4k3yFShBoYXNoZWRwcm9v" \
+ "ZnRva2VuegExugENc2VsZWN0ZWRzaXRlc8gBAQ.oFWNiNRCsbAVkadc7B2tMRqH4uqjR0oINcqsdEP8DOg"
+ end
+
+ let(:upload_url) do
+ "https://ymt6d.sharepoint.com/sites/OPTest/_api/v2.0/drives/b!FeOZEMfQx0eGQKqVBLcP__BG8mq-4-9FuRqOyk3MXY" \
+ "9jo6leJDqrT7muzvmiWjFW/items/01ANJ53W2OGTVJLOZ5R5F2NFJWGJOLV56J/uploadSession?guid=%27ca9855a1-245f-40b" \
+ "6-a2c3-ce8053d3a381%27&overwrite=False&rename=True&dc=0&tempauth=#{token}"
+ end
+
+ "https://ymt6d.sharepoint.com/sites/OPTest/_api/v2.0/drives/b!FeOZEMfQx0eGQKqVBLcP__BG8mq-4-9FuRqOyk3MXY9jo6leJDqrT7muzvmiWjFW/items/01ANJ53W2OGTVJLOZ5R5F2NFJWGJOLV56J/uploadSession?guid=''ca9855a1-245f-40b6-a2c3-ce8053d3a381''&overwrite=False&rename=True&dc=0&tempauth=v1.eyJzaXRlaWQiOiIxMDk5ZTMxNS1kMGM3LTQ3YzctODY0MC1hYTk1MDRiNzBmZmYiLCJhcHBfZGlzcGxheW5hbWUiOiJPUCBTZWxlY3RlZCIsIm5hbWVpZCI6IjQwNGUwNTY3LTE5YTEtNGE2NC1iMmQxLWQzYjBjOTlmMmVkOUBlMzZmMWRiYy1mZGFlLTQyN2UtYjYxYi0wZDk2ZGRmYjgxYTQiLCJhdWQiOiIwMDAwMDAwMy0wMDAwLTBmZjEtY2UwMC0wMDAwMDAwMDAwMDAveW10NmQuc2hhcmVwb2ludC5jb21AZTM2ZjFkYmMtZmRhZS00MjdlLWI2MWItMGQ5NmRkZmI4MWE0IiwiZXhwIjoiMTc1NTA5MDQ5OSJ9.CkAKDGVudHJhX2NsYWltcxIwQ0piMzdNUUdFQUFhRmpKMU16bElUalJHTFZVeVJWQm9OblpPTmpSUlFVRXFBQT09CjIKCmFjdG9yYXBwaWQSJDAwMDAwMDAzLTAwMDAtMDAwMC1jMDAwLTAwMDAwMDAwMDAwMAoKCgRzbmlkEgI2NhILCI7l0_Dq6qw-EAUaDjIwLjE5MC4xOTAuMTAyKixZYldpRDFScDM5SGNsREo0dXQrck5xUjJjelRwbmgya3lSZlhWVnVaZnVBPTCBAjgBQhChuwki92AAAHU0wDr4k3yFShBoYXNoZWRwcm9vZnRva2VuegExugENc2VsZWN0ZWRzaXRlc8gBAQ.oFWNiNRCsbAVkadc7B2tMRqH4uqjR0oINcqsdEP8DOg"
+
+ it_behaves_like "adapter upload_link_query: successful upload link response"
+ end
+
+ context "when requesting an upload link for a not existing file", vcr: "share_point/upload_link_not_found" do
+ let(:input_data) do
+ Input::UploadLink.build(
+ folder_id:
+ "b!FeOZEMfQx0eGQKqVBLcP__BG8mq-4-9FuRqOyk3MXY8Qconfm2i6SKEoCmuGYqQK||04AZJL5PN6Y2GOVW7725BZO354PWSELRRZ",
+ file_name: "DeathStart_blueprints.tiff"
+ ).value!
+ end
+
+ it_behaves_like "adapter upload_link_query: not found"
+ end
+ end
+ end
+ end
+ end
+ end
+end
diff --git a/modules/storages/spec/support/fixtures/vcr_cassettes/share_point/upload_link_not_found.yml b/modules/storages/spec/support/fixtures/vcr_cassettes/share_point/upload_link_not_found.yml
new file mode 100644
index 00000000000..9cc7c3dba8c
--- /dev/null
+++ b/modules/storages/spec/support/fixtures/vcr_cassettes/share_point/upload_link_not_found.yml
@@ -0,0 +1,115 @@
+---
+http_interactions:
+- request:
+ method: post
+ uri: https://login.microsoftonline.com/e36f1dbc-fdae-427e-b61b-0d96ddfb81a4/oauth2/v2.0/token
+ body:
+ encoding: ASCII-8BIT
+ string: grant_type=client_credentials&scope=https%3A%2F%2Fgraph.microsoft.com%2F.default+offline_access&client_id=404e0567-19a1-4a64-b2d1-d3b0c99f2ed9&client_secret=QRB8Q%7Ei.1rID_.MC9FTfRGq-FTE5SgWYsoeLacWf
+ headers:
+ User-Agent:
+ - httpx.rb/1.3.4
+ Accept:
+ - "*/*"
+ Accept-Encoding:
+ - gzip, deflate
+ Content-Type:
+ - application/x-www-form-urlencoded
+ Content-Length:
+ - '199'
+ response:
+ status:
+ code: 200
+ message: OK
+ headers:
+ Cache-Control:
+ - no-store, no-cache
+ Pragma:
+ - no-cache
+ Content-Type:
+ - application/json; charset=utf-8
+ Expires:
+ - "-1"
+ Strict-Transport-Security:
+ - max-age=31536000; includeSubDomains
+ X-Content-Type-Options:
+ - nosniff
+ P3p:
+ - CP="DSP CUR OTPi IND OTRi ONL FIN"
+ X-Ms-Request-Id:
+ - b1f6b609-aec6-44e7-ae7b-8a294b5e2400
+ X-Ms-Ests-Server:
+ - 2.1.21470.12 - NEULR1 ProdSlices
+ X-Ms-Srs:
+ - 1.P
+ Content-Security-Policy-Report-Only:
+ - object-src 'none'; base-uri 'self'; script-src 'self' 'nonce-w--SvBb_mGyro9e7QQkw7Q'
+ 'unsafe-inline' 'unsafe-eval' https://*.msauth.net https://*.msftauth.net
+ https://*.msftauthimages.net https://*.msauthimages.net https://*.msidentity.com
+ https://*.microsoftonline-p.com https://*.microsoftazuread-sso.com https://*.azureedge.net
+ https://*.outlook.com https://*.office.com https://*.office365.com https://*.microsoft.com
+ https://*.bing.com 'report-sample'; report-uri https://csp.microsoft.com/report/ESTS-UX-All
+ X-Xss-Protection:
+ - '0'
+ Set-Cookie:
+ - fpc=ArNmpTDC6oBBvxeXbT5TTTRZ-dCOAQAAACU1LeAOAAAA; expires=Thu, 11-Sep-2025
+ 13:14:13 GMT; path=/; secure; HttpOnly; SameSite=None, x-ms-gateway-slice=estsfd;
+ path=/; secure; samesite=none; httponly, stsservicecookie=estsfd; path=/;
+ secure; samesite=none; httponly
+ Date:
+ - Tue, 12 Aug 2025 13:14:12 GMT
+ Content-Length:
+ - '1935'
+ body:
+ encoding: UTF-8
+ string: '{"token_type":"Bearer","expires_in":3599,"ext_expires_in":3599,"access_token":"<ACCESS_TOKEN>"}'
+ recorded_at: Tue, 12 Aug 2025 13:14:13 GMT
+- request:
+ method: post
+ uri: https://graph.microsoft.com/v1.0/drives/b!FeOZEMfQx0eGQKqVBLcP__BG8mq-4-9FuRqOyk3MXY8Qconfm2i6SKEoCmuGYqQK/items/04AZJL5PN6Y2GOVW7725BZO354PWSELRRZ:/DeathStart_blueprints.tiff:/createUploadSession
+ body:
+ encoding: UTF-8
+ string: '{"item":{"@microsoft.graph.conflictBehavior":"rename","name":"DeathStart_blueprints.tiff"}}'
+ headers:
+ User-Agent:
+ - httpx.rb/1.3.4
+ Accept:
+ - "*/*"
+ Accept-Encoding:
+ - gzip, deflate
+ Content-Type:
+ - application/json; charset=utf-8
+ Content-Length:
+ - '91'
+ Authorization:
+ - Bearer <BEARER TOKEN>
+ response:
+ status:
+ code: 400
+ message: Bad Request
+ headers:
+ Cache-Control:
+ - no-store, no-cache
+ Content-Type:
+ - application/json
+ Content-Encoding:
+ - gzip
+ Vary:
+ - Accept-Encoding
+ Strict-Transport-Security:
+ - max-age=31536000
+ Request-Id:
+ - 564c4ce4-85d8-4e76-860e-8a4307725919
+ Client-Request-Id:
+ - 564c4ce4-85d8-4e76-860e-8a4307725919
+ X-Ms-Ags-Diagnostic:
+ - '{"ServerInfo":{"DataCenter":"Germany West Central","Slice":"E","Ring":"4","ScaleUnit":"006","RoleInstance":"FR1PEPF0000321E"}}'
+ Splogid:
+ - 7909bba1-50b5-0000-7534-c517b7896a89
+ Date:
+ - Tue, 12 Aug 2025 13:14:13 GMT
+ body:
+ encoding: UTF-8
+ string: '{"error":{"code":"invalidRequest","message":"Invalid request","innerError":{"date":"2025-08-12T13:14:13","request-id":"564c4ce4-85d8-4e76-860e-8a4307725919","client-request-id":"564c4ce4-85d8-4e76-860e-8a4307725919"}}}'
+ recorded_at: Tue, 12 Aug 2025 13:14:13 GMT
+recorded_with: VCR 6.3.1
diff --git a/modules/storages/spec/support/fixtures/vcr_cassettes/share_point/upload_link_subfolder.yml b/modules/storages/spec/support/fixtures/vcr_cassettes/share_point/upload_link_subfolder.yml
new file mode 100644
index 00000000000..461f23bd4a4
--- /dev/null
+++ b/modules/storages/spec/support/fixtures/vcr_cassettes/share_point/upload_link_subfolder.yml
@@ -0,0 +1,119 @@
+---
+http_interactions:
+- request:
+ method: post
+ uri: https://login.microsoftonline.com/e36f1dbc-fdae-427e-b61b-0d96ddfb81a4/oauth2/v2.0/token
+ body:
+ encoding: ASCII-8BIT
+ string: grant_type=client_credentials&scope=https%3A%2F%2Fgraph.microsoft.com%2F.default+offline_access&client_id=404e0567-19a1-4a64-b2d1-d3b0c99f2ed9&client_secret=QRB8Q%7Ei.1rID_.MC9FTfRGq-FTE5SgWYsoeLacWf
+ headers:
+ User-Agent:
+ - httpx.rb/1.3.4
+ Accept:
+ - "*/*"
+ Accept-Encoding:
+ - gzip, deflate
+ Content-Type:
+ - application/x-www-form-urlencoded
+ Content-Length:
+ - '199'
+ response:
+ status:
+ code: 200
+ message: OK
+ headers:
+ Cache-Control:
+ - no-store, no-cache
+ Pragma:
+ - no-cache
+ Content-Type:
+ - application/json; charset=utf-8
+ Expires:
+ - "-1"
+ Strict-Transport-Security:
+ - max-age=31536000; includeSubDomains
+ X-Content-Type-Options:
+ - nosniff
+ P3p:
+ - CP="DSP CUR OTPi IND OTRi ONL FIN"
+ X-Ms-Request-Id:
+ - 1cfdedda-05de-4df9-843e-1eaf37ae1000
+ X-Ms-Ests-Server:
+ - 2.1.21470.12 - WEULR1 ProdSlices
+ X-Ms-Srs:
+ - 1.P
+ Content-Security-Policy-Report-Only:
+ - object-src 'none'; base-uri 'self'; script-src 'self' 'nonce-aQOrupSTD3VfG_100yqQvg'
+ 'unsafe-inline' 'unsafe-eval' https://*.msauth.net https://*.msftauth.net
+ https://*.msftauthimages.net https://*.msauthimages.net https://*.msidentity.com
+ https://*.microsoftonline-p.com https://*.microsoftazuread-sso.com https://*.azureedge.net
+ https://*.outlook.com https://*.office.com https://*.office365.com https://*.microsoft.com
+ https://*.bing.com 'report-sample'; report-uri https://csp.microsoft.com/report/ESTS-UX-All
+ X-Xss-Protection:
+ - '0'
+ Set-Cookie:
+ - fpc=AlEfuBYWzv9PhdSrNdl5m0hZ-dCOAQAAAMEzLeAOAAAA; expires=Thu, 11-Sep-2025
+ 13:08:18 GMT; path=/; secure; HttpOnly; SameSite=None, x-ms-gateway-slice=estsfd;
+ path=/; secure; samesite=none; httponly, stsservicecookie=estsfd; path=/;
+ secure; samesite=none; httponly
+ Date:
+ - Tue, 12 Aug 2025 13:08:17 GMT
+ Content-Length:
+ - '1932'
+ body:
+ encoding: UTF-8
+ string: '{"token_type":"Bearer","expires_in":3599,"ext_expires_in":3599,"access_token":"<ACCESS_TOKEN>"}'
+ recorded_at: Tue, 12 Aug 2025 13:08:18 GMT
+- request:
+ method: post
+ uri: https://graph.microsoft.com/v1.0/drives/b!FeOZEMfQx0eGQKqVBLcP__BG8mq-4-9FuRqOyk3MXY9jo6leJDqrT7muzvmiWjFW/items/01ANJ53W5P3SUY3ZCDTRA3KLXRGA5A2M3S:/DeathStart_blueprints.tiff:/createUploadSession
+ body:
+ encoding: UTF-8
+ string: '{"item":{"@microsoft.graph.conflictBehavior":"rename","name":"DeathStart_blueprints.tiff"}}'
+ headers:
+ User-Agent:
+ - httpx.rb/1.3.4
+ Accept:
+ - "*/*"
+ Accept-Encoding:
+ - gzip, deflate
+ Content-Type:
+ - application/json; charset=utf-8
+ Content-Length:
+ - '91'
+ Authorization:
+ - Bearer <BEARER TOKEN>
+ response:
+ status:
+ code: 200
+ message: OK
+ headers:
+ Cache-Control:
+ - no-store, no-cache
+ Content-Type:
+ - application/json;odata.metadata=minimal;odata.streaming=true;IEEE754Compatible=false;charset=utf-8
+ Content-Encoding:
+ - gzip
+ Location:
+ - https://graph.microsoft.com
+ Vary:
+ - Accept-Encoding
+ Strict-Transport-Security:
+ - max-age=31536000
+ Request-Id:
+ - 1599c5d6-ca6b-4344-bc96-ccbc2c7cd4a2
+ Client-Request-Id:
+ - 1599c5d6-ca6b-4344-bc96-ccbc2c7cd4a2
+ X-Ms-Ags-Diagnostic:
+ - '{"ServerInfo":{"DataCenter":"Germany West Central","Slice":"E","Ring":"4","ScaleUnit":"002","RoleInstance":"FR3PEPF00000351"}}'
+ Splogid:
+ - 2209bba1-60f7-0000-7534-c03af8937c85
+ Odata-Version:
+ - '4.0'
+ Date:
+ - Tue, 12 Aug 2025 13:08:19 GMT
+ body:
+ encoding: UTF-8
+ string: '{"@odata.context":"https://graph.microsoft.com/v1.0/$metadata#microsoft.graph.uploadSession","expirationDateTime":"2025-08-12T13:23:18.969Z","nextExpectedRanges":["0-"],"uploadUrl":"https://ymt6d.sharepoint.com/sites/OPTest/_api/v2.0/drives/b!FeOZEMfQx0eGQKqVBLcP__BG8mq-4-9FuRqOyk3MXY9jo6leJDqrT7muzvmiWjFW/items/01ANJ53W2OGTVJLOZ5R5F2NFJWGJOLV56J/uploadSession?guid=''ca9855a1-245f-40b6-a2c3-ce8053d3a381''&overwrite=False&rename=True&dc=0&tempauth=v1.eyJzaXRlaWQiOiIxMDk5ZTMxNS1kMGM3LTQ3YzctODY0MC1hYTk1MDRiNzBmZmYiLCJhcHBfZGlzcGxheW5hbWUiOiJPUCBTZWxlY3RlZCIsIm5hbWVpZCI6IjQwNGUwNTY3LTE5YTEtNGE2NC1iMmQxLWQzYjBjOTlmMmVkOUBlMzZmMWRiYy1mZGFlLTQyN2UtYjYxYi0wZDk2ZGRmYjgxYTQiLCJhdWQiOiIwMDAwMDAwMy0wMDAwLTBmZjEtY2UwMC0wMDAwMDAwMDAwMDAveW10NmQuc2hhcmVwb2ludC5jb21AZTM2ZjFkYmMtZmRhZS00MjdlLWI2MWItMGQ5NmRkZmI4MWE0IiwiZXhwIjoiMTc1NTA5MDQ5OSJ9.CkAKDGVudHJhX2NsYWltcxIwQ0piMzdNUUdFQUFhRmpKMU16bElUalJHTFZVeVJWQm9OblpPTmpSUlFVRXFBQT09CjIKCmFjdG9yYXBwaWQSJDAwMDAwMDAzLTAwMDAtMDAwMC1jMDAwLTAwMDAwMDAwMDAwMAoKCgRzbmlkEgI2NhILCI7l0_Dq6qw-EAUaDjIwLjE5MC4xOTAuMTAyKixZYldpRDFScDM5SGNsREo0dXQrck5xUjJjelRwbmgya3lSZlhWVnVaZnVBPTCBAjgBQhChuwki92AAAHU0wDr4k3yFShBoYXNoZWRwcm9vZnRva2VuegExugENc2VsZWN0ZWRzaXRlc8gBAQ.oFWNiNRCsbAVkadc7B2tMRqH4uqjR0oINcqsdEP8DOg"}'
+ recorded_at: Tue, 12 Aug 2025 13:08:19 GMT
+recorded_with: VCR 6.3.1
diff --git a/modules/storages/spec/support/fixtures/vcr_cassettes/share_point/upload_link_success.yml b/modules/storages/spec/support/fixtures/vcr_cassettes/share_point/upload_link_success.yml
new file mode 100644
index 00000000000..25f231387e7
--- /dev/null
+++ b/modules/storages/spec/support/fixtures/vcr_cassettes/share_point/upload_link_success.yml
@@ -0,0 +1,119 @@
+---
+http_interactions:
+- request:
+ method: post
+ uri: https://login.microsoftonline.com/e36f1dbc-fdae-427e-b61b-0d96ddfb81a4/oauth2/v2.0/token
+ body:
+ encoding: ASCII-8BIT
+ string: grant_type=client_credentials&scope=https%3A%2F%2Fgraph.microsoft.com%2F.default+offline_access&client_id=404e0567-19a1-4a64-b2d1-d3b0c99f2ed9&client_secret=QRB8Q%7Ei.1rID_.MC9FTfRGq-FTE5SgWYsoeLacWf
+ headers:
+ User-Agent:
+ - httpx.rb/1.3.4
+ Accept:
+ - "*/*"
+ Accept-Encoding:
+ - gzip, deflate
+ Content-Type:
+ - application/x-www-form-urlencoded
+ Content-Length:
+ - '199'
+ response:
+ status:
+ code: 200
+ message: OK
+ headers:
+ Cache-Control:
+ - no-store, no-cache
+ Pragma:
+ - no-cache
+ Content-Type:
+ - application/json; charset=utf-8
+ Expires:
+ - "-1"
+ Strict-Transport-Security:
+ - max-age=31536000; includeSubDomains
+ X-Content-Type-Options:
+ - nosniff
+ P3p:
+ - CP="DSP CUR OTPi IND OTRi ONL FIN"
+ X-Ms-Request-Id:
+ - af06b92c-2b59-4bc2-8ae9-9a3d8a5a5f00
+ X-Ms-Ests-Server:
+ - 2.1.21470.11 - FRC ProdSlices
+ X-Ms-Srs:
+ - 1.P
+ Content-Security-Policy-Report-Only:
+ - object-src 'none'; base-uri 'self'; script-src 'self' 'nonce-eD9bRpc_Aa_gWZPBrAwR0Q'
+ 'unsafe-inline' 'unsafe-eval' https://*.msauth.net https://*.msftauth.net
+ https://*.msftauthimages.net https://*.msauthimages.net https://*.msidentity.com
+ https://*.microsoftonline-p.com https://*.microsoftazuread-sso.com https://*.azureedge.net
+ https://*.outlook.com https://*.office.com https://*.office365.com https://*.microsoft.com
+ https://*.bing.com 'report-sample'; report-uri https://csp.microsoft.com/report/ESTS-UX-All
+ X-Xss-Protection:
+ - '0'
+ Set-Cookie:
+ - fpc=AmIqy3cQKMdJvusHJv4b8IZZ-dCOAQAAAAu_K-AOAAAA; expires=Wed, 10-Sep-2025
+ 10:38:04 GMT; path=/; secure; HttpOnly; SameSite=None, x-ms-gateway-slice=estsfd;
+ path=/; secure; samesite=none; httponly, stsservicecookie=estsfd; path=/;
+ secure; samesite=none; httponly
+ Date:
+ - Mon, 11 Aug 2025 10:38:04 GMT
+ Content-Length:
+ - '1925'
+ body:
+ encoding: UTF-8
+ string: '{"token_type":"Bearer","expires_in":3599,"ext_expires_in":3599,"access_token":"<ACCESS_TOKEN>"}'
+ recorded_at: Mon, 11 Aug 2025 10:38:04 GMT
+- request:
+ method: post
+ uri: https://graph.microsoft.com/v1.0/drives/b!FeOZEMfQx0eGQKqVBLcP__BG8mq-4-9FuRqOyk3MXY8Qconfm2i6SKEoCmuGYqQK/items/root:/DeathStart_blueprints.tiff:/createUploadSession
+ body:
+ encoding: UTF-8
+ string: '{"item":{"@microsoft.graph.conflictBehavior":"rename","name":"DeathStart_blueprints.tiff"}}'
+ headers:
+ User-Agent:
+ - httpx.rb/1.3.4
+ Accept:
+ - "*/*"
+ Accept-Encoding:
+ - gzip, deflate
+ Content-Type:
+ - application/json; charset=utf-8
+ Content-Length:
+ - '91'
+ Authorization:
+ - Bearer <BEARER TOKEN>
+ response:
+ status:
+ code: 200
+ message: OK
+ headers:
+ Cache-Control:
+ - no-store, no-cache
+ Content-Type:
+ - application/json;odata.metadata=minimal;odata.streaming=true;IEEE754Compatible=false;charset=utf-8
+ Content-Encoding:
+ - gzip
+ Location:
+ - https://graph.microsoft.com
+ Vary:
+ - Accept-Encoding
+ Strict-Transport-Security:
+ - max-age=31536000
+ Request-Id:
+ - 11d5399e-3605-4cbb-b559-b4bbe6d97644
+ Client-Request-Id:
+ - 11d5399e-3605-4cbb-b559-b4bbe6d97644
+ X-Ms-Ags-Diagnostic:
+ - '{"ServerInfo":{"DataCenter":"Germany West Central","Slice":"E","Ring":"4","ScaleUnit":"001","RoleInstance":"FR2PEPF000003EA"}}'
+ Splogid:
+ - 24aebaa1-50ac-0000-7a8c-c21d7730abda
+ Odata-Version:
+ - '4.0'
+ Date:
+ - Mon, 11 Aug 2025 10:38:05 GMT
+ body:
+ encoding: UTF-8
+ string: '{"@odata.context":"https://graph.microsoft.com/v1.0/$metadata#microsoft.graph.uploadSession","expirationDateTime":"2025-08-11T10:53:05.45Z","nextExpectedRanges":["0-"],"uploadUrl":"https://ymt6d.sharepoint.com/sites/OPTest/_api/v2.0/drives/b!FeOZEMfQx0eGQKqVBLcP__BG8mq-4-9FuRqOyk3MXY8Qconfm2i6SKEoCmuGYqQK/items/01ANJ53WYPWYGIOMO3WFGK2YENXB7ESIS5/uploadSession?guid=''5fa68ee0-d944-4323-817a-2bf0ece08ae5''&overwrite=False&rename=True&dc=0&tempauth=v1.eyJzaXRlaWQiOiIxMDk5ZTMxNS1kMGM3LTQ3YzctODY0MC1hYTk1MDRiNzBmZmYiLCJhcHBfZGlzcGxheW5hbWUiOiJPUCBTZWxlY3RlZCIsIm5hbWVpZCI6IjQwNGUwNTY3LTE5YTEtNGE2NC1iMmQxLWQzYjBjOTlmMmVkOUBlMzZmMWRiYy1mZGFlLTQyN2UtYjYxYi0wZDk2ZGRmYjgxYTQiLCJhdWQiOiIwMDAwMDAwMy0wMDAwLTBmZjEtY2UwMC0wMDAwMDAwMDAwMDAveW10NmQuc2hhcmVwb2ludC5jb21AZTM2ZjFkYmMtZmRhZS00MjdlLWI2MWItMGQ5NmRkZmI4MWE0IiwiZXhwIjoiMTc1NDk5NTA4NSJ9.CkAKDGVudHJhX2NsYWltcxIwQ09DTjU4UUdFQUFhRmt4TWEwZHlNV3R5ZDJ0MVN6WmFiemxwYkhCbVFVRXFBQT09CjIKCmFjdG9yYXBwaWQSJDAwMDAwMDAzLTAwMDAtMDAwMC1jMDAwLTAwMDAwMDAwMDAwMAoKCgRzbmlkEgI2NhILCKa2j4Kms6w-EAUaDjIwLjE5MC4xOTAuMTAwKixhM1l1blg1YkN6MFBCVjM3S2RGblA1QWdyL08wYllnS0FIeU1rU3Rvam1jPTCBAjgBQhChuq4krFAAAHqMwh13MKvaShBoYXNoZWRwcm9vZnRva2VuegExugENc2VsZWN0ZWRzaXRlc8gBAQ._udXSV3Fv81Ws1n5RdRe3aKpVRVZIewLPNiHh8CVjy0"}'
+ recorded_at: Mon, 11 Aug 2025 10:38:05 GMT
+recorded_with: VCR 6.3.1