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

Đang mở Phù hợp với người mới
#179 1 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức phù hợp với người mới
65/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
azure, csharp
Lĩnh vực
backend, cloud

Hướng nghiên cứu

Bắt đầu với phần chuyển đổi danh sách trong FluentStorage.Azure.Blobs/Storage/AzureBlobStore.cs, khoảng dòng 532–578, rồi so sánh với cách xây dựng đường dẫn đọc khoảng dòng 628–656. Theo dõi cách container cố định và blobPrefix được áp dụng vào tên blob được tái tạo; hoàn tất khi ListObjects trả về FullPath mà OpenRead có thể sử dụng mà không nhân đôi tiền tố.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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.

Ngôn ngữ chính
C#
Star
464
Fork
78
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Chuẩn bị môi trường

  • Không có Dockerfile hay tệp Docker Compose
  • Có mẫu pull request
  • Không có hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của robinrodricks/FluentStorage

Tất cả issue của robinrodricks/FluentStorage

Issue tương tự

Thêm issue về C#

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.