From 0cf7c03d14770e79217db7f9f689d8d1e0e7fecb Mon Sep 17 00:00:00 2001 From: bdovaz Date: Tue, 12 Sep 2023 22:28:24 +0200 Subject: [PATCH 1/2] Prevent the generation of invalid .meta files --- src/UnityNuGet/RegistryCache.cs | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/src/UnityNuGet/RegistryCache.cs b/src/UnityNuGet/RegistryCache.cs index 5ee04962..830630b7 100644 --- a/src/UnityNuGet/RegistryCache.cs +++ b/src/UnityNuGet/RegistryCache.cs @@ -31,7 +31,7 @@ namespace UnityNuGet public class RegistryCache { public static readonly bool IsRunningOnAzure = !string.IsNullOrEmpty(Environment.GetEnvironmentVariable("WEBSITE_SITE_NAME")); - + // Change this version number if the content of the packages are changed by an update of this class private const string CurrentRegistryVersion = "1.6.0"; @@ -209,7 +209,7 @@ private async Task BuildInternal() // Clear the cache entirely _npmPackageRegistry.Reset(); } - + var regexFilter = Filter != null ? new Regex(Filter, RegexOptions.IgnoreCase) : null; if (Filter != null) { @@ -744,7 +744,17 @@ RegistryEntry packageEntry // Collect the folders' metas { string? fullPath = Path.GetDirectoryName(fileInUnityPackage); - string[] folders = fullPath?.Split(Path.DirectorySeparatorChar) ?? Array.Empty(); + string[] folders; + + if (!string.IsNullOrEmpty(fullPath)) + { + folders = fullPath.Split(Path.DirectorySeparatorChar); + } + else + { + folders = Array.Empty(); + } + string folder = string.Empty; foreach (var relative in folders) From b8aa9008e80548c49e1bd265fcfb9b5ce75a5b5e Mon Sep 17 00:00:00 2001 From: bdovaz Date: Tue, 12 Sep 2023 22:31:54 +0200 Subject: [PATCH 2/2] Bump registry version --- src/UnityNuGet/RegistryCache.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/UnityNuGet/RegistryCache.cs b/src/UnityNuGet/RegistryCache.cs index 830630b7..e4ef58fd 100644 --- a/src/UnityNuGet/RegistryCache.cs +++ b/src/UnityNuGet/RegistryCache.cs @@ -33,7 +33,7 @@ public class RegistryCache public static readonly bool IsRunningOnAzure = !string.IsNullOrEmpty(Environment.GetEnvironmentVariable("WEBSITE_SITE_NAME")); // Change this version number if the content of the packages are changed by an update of this class - private const string CurrentRegistryVersion = "1.6.0"; + private const string CurrentRegistryVersion = "1.7.0"; private static readonly Encoding Utf8EncodingNoBom = new UTF8Encoding(false, false); private readonly string _rootPersistentFolder;