From 63c18ee922fcb6d6e51c531c9265c369328992bd Mon Sep 17 00:00:00 2001 From: Kevin Hahn Date: Thu, 15 Aug 2024 16:20:16 +0700 Subject: [PATCH] fix test failures where `rootOfPath` was unexpectedly null --- src/SIL.LCModel/LinkedFilesRelativePathHelper.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/SIL.LCModel/LinkedFilesRelativePathHelper.cs b/src/SIL.LCModel/LinkedFilesRelativePathHelper.cs index db997587..92681132 100644 --- a/src/SIL.LCModel/LinkedFilesRelativePathHelper.cs +++ b/src/SIL.LCModel/LinkedFilesRelativePathHelper.cs @@ -274,6 +274,8 @@ private static string GetPathWithLowercaseRoot(string path) try { var rootOfPath = Path.GetPathRoot(path); + // dotnet 8 on linux, when path contains invalid characters rootOfPath will be null + if (rootOfPath is null) return path.ToLowerInvariant(); return rootOfPath.ToLowerInvariant() + path.Substring(rootOfPath.Length, path.Length - rootOfPath.Length); }