Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 7, 2025

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 tisonkun and dqhl76 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