Skip to content

Comments

fix(core/services/fs): Returning empty dir while list a file path#6154

Merged
Xuanwo merged 2 commits intomainfrom
allow-list-file-endwiths-slash
May 7, 2025
Merged

fix(core/services/fs): Returning empty dir while list a file path#6154
Xuanwo merged 2 commits intomainfrom
allow-list-file-endwiths-slash

Conversation

@Xuanwo
Copy link
Member

@Xuanwo Xuanwo commented May 7, 2025

Which issue does this PR close?

None

Rationale for this change

As explained in code:

// If the path is not a directory, return an empty list
//
// The path could be a file or a symbolic link in this case.
// Returning a NotADirectory error to the user isn't helpful; instead,
// providing an empty directory is a more user-friendly. In fact, the dir
// `path/` does not exist.

What changes are included in this PR?

Returning empty dir instead of error while users trying to list over a file path.

Are there any user-facing changes?

Behavior changed when users list a file, they used to get an error.

@dosubot dosubot bot added size:M This PR changes 30-99 lines, ignoring generated files. releases-note/fix The PR fixes a bug or has a title that begins with "fix" labels May 7, 2025
@Xuanwo Xuanwo requested review from dqhl76 and tisonkun May 7, 2025 11:23
@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label May 7, 2025
@Xuanwo Xuanwo merged commit 97dc771 into main May 7, 2025
95 of 96 checks passed
@Xuanwo Xuanwo deleted the allow-list-file-endwiths-slash branch May 7, 2025 12:36
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:M This PR changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants