Azure Blobs: `ListObjects` returns paths with `blobPrefix` when a container is configured

オープン 初心者向け
#179 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
65/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
azure, csharp
領域
backend, cloud

調査の方向性

FluentStorage.Azure.Blobs/Storage/AzureBlobStore.cs の532~578行付近にある一覧変換から始め、628~656行付近にある読み取りパスの構築と比較します。固定コンテナーと blobPrefix が再構成された blob 名にどのように適用されるかを追います。ListObjects が、プレフィックスを重複させずに OpenRead で使用できる FullPath を返せば完了です。

索引モデルが issue の本文から書いたものです。

説明

Azure Blob bug

With FluentStorage.Azure.Blobs 8.0.24 and AzureBlobStorage.FromClient(client, containerName, blobPrefix), ListObjects queries the correct Azure prefix but returns StoreObject.FullPath with the prefix still attached. Passing that path to OpenRead applies the prefix a second time.

Reproduction

Given a container named documentos containing clientes/acme/relatorio.pdf:

var store = AzureBlobStorage.FromClient(client, "documentos", "clientes/acme");
var items = await store.ListObjects(new StorageListOptions
{
    FolderPath = "/",
    Recurse = true,
    IncludeAttributes = true
});

var file = items.Single(item => item.IsFile);
Console.WriteLine(file.FullPath);
await using var stream = await store.OpenRead(file.FullPath);

Expected: FullPath is relatorio.pdf. OpenRead addresses /documentos/clientes/acme/relatorio.pdf.

Observed: The list request has the correct prefix, but the returned path causes a duplicate prefix on read.

GET /documentos?restype=container&comp=list&prefix=clientes%2Facme%2F&include=Metadata
FullPath: clientes/acme/relatorio.pdf
HEAD /documentos/clientes/acme/clientes/acme/relatorio.pdf
Root cause

With a fixed container, AzureContainerBrowser returns blob names relative to that container. AzureBlobStore.ToStorePath tries to strip documentos/clientes/acme/ from clientes/acme/relatorio.pdf, so the name passes through unchanged. GetPartsAsync then adds clientes/acme when opening the file. [Listing conversion](https://github.com/robinrodricks/FluentStorage/blob/b91624123ca59b1c1b5ebdecd5364b2e28d86104/FluentStorage.Azure.Blobs/Storage/AzureBlobStore.cs#L532-L578) · [Read path construction](https://github.com/robinrodricks/FluentStorage/blob/b91624123ca59b1c1b5ebdecd5364b2e28d86104/FluentStorage.Azure.Blobs/Storage/AzureBlobStore.cs#L628-L656)

I generated the issue with Codex (bug at prod), if you agree I can create a PR.

主要言語
C#
スター
464
フォーク
78
PR マージ指標
30日以内にマージされた PR はありません

環境構築

  • Dockerfile・Docker Compose ファイルなし
  • プルリクエストのテンプレートあり
  • コントリビューションガイドなし

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

robinrodricks/FluentStorage のほかの issue

robinrodricks/FluentStorage の issue をすべて見る

似ている issue

C# の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。