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

未关闭 适合新手
#179 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
65/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
技术栈
azure, csharp
领域
backend, cloud

调研方向

从 FluentStorage.Azure.Blobs/Storage/AzureBlobStore.cs 第 532–578 行附近的列表转换开始,然后将其与第 628–656 行附近的读取路径构造进行比较。追踪固定容器和 blobPrefix 如何应用于还原出的 blob 名称;当 ListObjects 返回的 FullPath 可供 OpenRead 使用且不会重复前缀时,即为完成。

由索引模型根据 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 文件
  • 有 Pull Request 模板
  • 没有贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

robinrodricks/FluentStorage 的其他 Issue

查看 robinrodricks/FluentStorage 的全部 Issue

相似的 Issue

更多 C# Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。