Lokasi ngalangkungan proxy:   [ UP ]  
[Ngawartoskeun bug]   [Panyetelan cookie]                
Skip to content

fix(objectstore): replace the retired Azure Storage SDK with a REST client - #66437

Open
susnux wants to merge 5 commits into
masterfrom
feat/azure-blob-rest-client
Open

susnux wants to merge 5 commits into
masterfrom
feat/azure-blob-rest-client

Conversation

@susnux

@susnux susnux commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

Summary

php azure framework is deprecated and not maintained (archived) since 2024.
But we also did not work most of the SDK but only the REST API.

So instead us maintaining a library where we only use one class, this directly adds the REST API into files_external.
Moreover the SDK was pretty outdated, current Azure uses a newer API level not supported by the SDK so this class is based on the latest documentation of Azure APIs.

The dependency changes:
grafik

TODO

Checklist

AI (if applicable)

  • The content of this PR was partly or fully generated using AI (Claude Code, claude-opus-5-5)

…pers

The Content-Disposition for pre-signed downloads and the CA bundle
selection for primary storage connections lived in the S3 traits. Move
them into small shared helpers so other object store backends can use
them without duplicating the logic. No behaviour change.

Assisted-by: ClaudeCode:claude-opus-5-5
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
The Azure Storage PHP client libraries were retired by Microsoft in
March 2024. The object store only needs a handful of blob operations, so
implement them directly on top of IClient: Shared Key signing, put blob,
put block and block list, ranged get, properties, delete and copy with
waiting for pending copies. Requests that may succeed when repeated are
retried, errors are mapped to an AzureException with the HTTP status and
the Azure error code.

SeekableHttpStream only supported streams opened by the http:// wrapper,
as it read the Content-Range header from the wrapper data. Let the
callback also return a streamed IResponse so it works with IClient.

The Shared Key test vectors were computed with the retired library.

Assisted-by: ClaudeCode:claude-opus-5-5
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
Uploads reach the object store as php://input wrapped in a CountWrapper,
a stream that can neither seek nor report its size. Move the
NonSeekableStream helper out of the S3 test, make it hide the size like
php://input does and test writing such a stream for every object store.

Assisted-by: ClaudeCode:claude-opus-5-5
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
Uploading a file through WebDAV to Azure primary storage failed with
"411 MissingContentLengthHeader": the retired SDK guessed the size of the
upload stream by seeking, which fails for php://input, and then sent the
request without a Content-Length. Never rely on the stream size: read
the upload in blocks into a temporary buffer, send small objects in a
single Put Blob and larger ones as staged blocks committed with Put
Block List. The block ids are unique per upload, so concurrent uploads
to the same object cannot mix their blocks.

Reads use SeekableHttpStream, so objects are now seekable, and a missing
object throws a NotFoundException as documented by IObjectStore. Copies
wait for the copy to complete instead of returning while it is pending.

The configuration and the storage id are unchanged. New optional
arguments: upload_block_size, api_version, retries, connect_timeout,
timeout and use_nextcloud_bundle.

Fixes #14391

Assisted-by: ClaudeCode:claude-opus-5-5
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
Bump 3rdparty to remove microsoft/azure-storage-blob and
microsoft/azure-storage-common, which are no longer used.

Assisted-by: ClaudeCode:claude-opus-5-5
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
@susnux
susnux force-pushed the feat/azure-blob-rest-client branch from e120d5d to e0961f4 Compare November 9, 2026 15:17
@susnux
susnux removed this pull request from stack #66441 November 9, 2026 15:17
@susnux
susnux added this pull request to stack #66488 November 9, 2026 15:17
@susnux
susnux marked this pull request as ready for review November 9, 2026 15:21
@susnux
susnux requested review from a team as code owners November 9, 2026 15:21
@susnux
susnux requested review from GhassenKefi, leftybournes, pabzm and salmart-dev and removed request for a team November 9, 2026 15:21
@susnux
susnux requested a review from icewind1991 November 9, 2026 15:22
@susnux susnux added 3. to review Waiting for reviews and removed 2. developing Work in progress labels Nov 9, 2026
@joshtrichards

Copy link
Copy Markdown
Member

When I looked a bit into this awhile back I also noted, there is a community replacement for the former official SDK: https://github.com/php-oss-for-azure/azure-storage-blob-php

@susnux

susnux commented Nov 19, 2026

Copy link
Copy Markdown
Contributor Author

@joshtrichards I found that too some problem with it:

  1. its still on a very old API version
  2. we only need a very small subset of the API (see what we remove with this PR)
  3. its a single maintainer and not very actively developed

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Azure blob storage as primary storage - Content-Length HTTP header is missing

4 participants