Skip to content

Commit

Permalink
fix an edge case in FileUtils.IsFilePathValid where there's no directory
Browse files Browse the repository at this point in the history
  • Loading branch information
hahn-kev committed Jul 30, 2024
1 parent 8813c1c commit a114e3f
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/SIL.LCModel.Utils/FileUtils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -494,6 +494,7 @@ public static bool IsFilePathValid(string filename)
var invalidFileNameChars = Path.GetInvalidFileNameChars();
if (name.IndexOfAny(invalidFileNameChars) >= 0)
return false;
if (name == filename) return true;
var directoryPath = filename.Substring(0, filename.Length - name.Length);
if (directoryPath.IndexOfAny(Path.GetInvalidPathChars()) >= 0)
return false;
Expand Down

0 comments on commit a114e3f

Please sign in to comment.