Skip to content

fix(services/azfile): avoid defaulting list size to zero#7220

Merged
Xuanwo merged 1 commit intomainfrom
xuanwo/azfile-list-content-length
Feb 24, 2026
Merged

fix(services/azfile): avoid defaulting list size to zero#7220
Xuanwo merged 1 commit intomainfrom
xuanwo/azfile-list-content-length

Conversation

@Xuanwo
Copy link
Member

@Xuanwo Xuanwo commented Feb 23, 2026

Which issue does this PR close?

Part of #7062.

Rationale for this change

azfile lister currently treats missing Content-Length in list response as 0.
This conflates "unknown size" with "real zero-byte file", which breaks the mandatory list content-length semantics introduced in core.

What changes are included in this PR?

  • Update core/services/azfile/src/lister.rs:
    • Stop using unwrap_or(0) for file content_length.
    • Set content_length only when the service response includes Content-Length.

This keeps real zero-byte files correct while allowing core fallback completion logic to handle missing sizes safely.

Validation:

  • cargo fmt
  • cargo check --features services-azfile,tests
  • cargo test -p opendal-service-azfile

Are there any user-facing changes?

Yes.

For azfile, list entries no longer report content_length = 0 when Azure File list response omits content length.

AI Usage Statement

This PR was developed with Codex (GPT-5) assistance.

@dosubot dosubot bot added size:XS This PR changes 0-9 lines, ignoring generated files. releases-note/fix The PR fixes a bug or has a title that begins with "fix" labels Feb 23, 2026
@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Feb 23, 2026
@Xuanwo Xuanwo merged commit ef35d31 into main Feb 24, 2026
94 checks passed
@Xuanwo Xuanwo deleted the xuanwo/azfile-list-content-length branch February 24, 2026 04:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

lgtm This PR has been approved by a maintainer releases-note/fix The PR fixes a bug or has a title that begins with "fix" size:XS This PR changes 0-9 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants