Fix duplicate path join in OS filesystem utility#287
Merged
Conversation
Coverage Report for CI Build 26882796764Coverage remained the same at 97.515%Details
Uncovered ChangesNo uncovered changes found. Coverage RegressionsNo coverage regressions found. Coverage Stats
💛 - Coveralls |
Member
Any patch affecting code relying on buggy behavior should not be considered a breaking change. This is fine. |
System-Glitch
approved these changes
Jun 3, 2026
8b82c24 to
d508550
Compare
d508550 to
f3617b8
Compare
Member
|
Merged. Thanks! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
References
Issue(s): N/A
Discussion: N/A
Description
Fix
osfs.FS.FileExistsandosfs.FS.IsDirectorywhen a base directory is configured withNew(...).Previously, both methods called
path.Join(f.dir, name)before delegating tof.Stat(name). SinceStatalready resolves the given path relative to the filesystem base directory, the base path was effectively joined twice. This caused lookups such asNew("resources").FileExists("test_file.txt")andNew("resources").IsDirectory("lang")to fail unexpectedly.This PR removes the duplicated
path.Joinin both methods and adds regression tests coveringFileExistsandIsDirectorywith a configured base directory.Usage example
Possible drawbacks
This change slightly alters the behavior of
FileExistsandIsDirectoryfor callers relying on the previous incorrect path resolution. However, the new behavior is consistent with the rest of the filesystem abstraction and with howStatalready handles base directories.