From a114e3fdd3f4ac0e2e08a7391e772c38cdab8a15 Mon Sep 17 00:00:00 2001 From: Kevin Hahn Date: Tue, 30 Jul 2024 16:40:52 +0700 Subject: [PATCH] fix an edge case in FileUtils.IsFilePathValid where there's no directory --- src/SIL.LCModel.Utils/FileUtils.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/SIL.LCModel.Utils/FileUtils.cs b/src/SIL.LCModel.Utils/FileUtils.cs index f22dbb4e..7b5f1b40 100644 --- a/src/SIL.LCModel.Utils/FileUtils.cs +++ b/src/SIL.LCModel.Utils/FileUtils.cs @@ -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;