Skip to content
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

Defend against directories without trailing slashes #104022

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

precup
Copy link

@precup precup commented Mar 12, 2025

Fixes #103992

FileSystemDock::create_directory can get called with a base_dir that don't have a trailing slash in a couple ways. It seemed like a footgun for it to require a trailing slash, so I fixed the issue by making it tolerant to either formatting.

After that, I audited similar usages of trim combined with paths in the rest of the codebase since this seems like an easy mistake to make, and the editor_file_system change addresses the only one that seemed similarly easy to make a mistake with and is a cheap enough addition it seemed reasonable to add defensively.

This largely occurs because String::get_base_dir returns a result without a trailing slash. Since this is also a base_dir, it seems like it should accept things straight from String::get_base_dir.

@precup precup requested a review from a team as a code owner March 12, 2025 12:36
@AThousandShips AThousandShips added this to the 4.5 milestone Mar 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Folder Creation fails(Show in File System) : New Folder (Could not create folder: Can't create)
2 participants