This commit is contained in:
2026-08-17 02:12:17 +08:00
parent 560ae46b82
commit 6a05803e08
96 changed files with 2888 additions and 685 deletions
+10 -5
View File
@@ -132,10 +132,11 @@ func (uc *MediaUsecase) ListStorage(ctx context.Context, prefix, cursor string,
if limit <= 0 {
limit = 100
}
// Multipart chunks are staged on the local filesystem, so listOssFiles
// never exposes them. Kra's storage abstraction may stage them through
// the selected backend; hide the internal prefix to preserve the API.
chunkRoot := ".chunks"
// Multipart chunks are an internal staging detail. The compatible local
// implementation keeps them outside the configured object-storage root, so
// the public listing must not expose them even when the selected backend is
// also used for staging.
chunkRoot := "uploads/chunks"
if uc.settings != nil {
if configured := strings.Trim(uc.settings.MediaSettings().ChunkDir, "/\\ "); configured != "" {
chunkRoot = configured
@@ -145,7 +146,11 @@ func (uc *MediaUsecase) ListStorage(ctx context.Context, prefix, cursor string,
result := make([]*StoredFile, 0, limit)
nextCursor := cursor
for {
items, next, more, err := uc.files.List(ctx, prefix, nextCursor, limit)
// Ask only for the remaining visible capacity. Otherwise a page that is
// partially filtered could fill the response halfway through the next
// storage page while returning that page's end cursor, skipping objects.
remaining := limit - len(result)
items, next, more, err := uc.files.List(ctx, prefix, nextCursor, remaining)
if err != nil {
return nil, "", false, err
}