Skip to content

Comments

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

Open
Xuanwo wants to merge 1 commit intomainfrom
xuanwo/azfile-list-content-length
Open

fix(services/azfile): avoid defaulting list size to zero#7220
Xuanwo wants to merge 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
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