From 3e4be5adc4d63561ed5e2afc877f6d7e3591dd66 Mon Sep 17 00:00:00 2001 From: Kirill Krylo Date: Fri, 13 Sep 2024 02:17:37 +0200 Subject: [PATCH] filename fix --- .../ComposableApplicationManagerTestCase.cs | 4 ++-- clio/ComposableApplication/ComposableApplicationManager.cs | 6 ++++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/clio.tests/ComposableApplication/ComposableApplicationManagerTestCase.cs b/clio.tests/ComposableApplication/ComposableApplicationManagerTestCase.cs index 3f8837f4..a9e4b50d 100644 --- a/clio.tests/ComposableApplication/ComposableApplicationManagerTestCase.cs +++ b/clio.tests/ComposableApplication/ComposableApplicationManagerTestCase.cs @@ -57,8 +57,8 @@ const string expectedFilePath string appDescriptorContent = FileSystem.File.ReadAllText(expectedFilePath); AppDescriptorJson appDescriptor = JsonConvert.DeserializeObject(appDescriptorContent); - string iconFileName = Path.GetFileName(IconPath); - string timestampPattern = @"\d{14}$"; // Matches the datetime format "yyyyMMddHHmmss" + string iconFileName = Path.GetFileNameWithoutExtension(IconPath); + string timestampPattern = @"\d{14}.svg$"; // Matches the datetime format "yyyyMMddHHmmss" appDescriptor.IconName.Should().MatchRegex($"{iconFileName}_{timestampPattern}"); appDescriptor.Icon.Should().Be(PartnerSvgBase64); } diff --git a/clio/ComposableApplication/ComposableApplicationManager.cs b/clio/ComposableApplication/ComposableApplicationManager.cs index 3c14d135..87e9b978 100644 --- a/clio/ComposableApplication/ComposableApplicationManager.cs +++ b/clio/ComposableApplication/ComposableApplicationManager.cs @@ -116,9 +116,11 @@ public void SetIcon(string packagesFolderPath, string iconPath, string appName){ } var matchingFile = matchingFiles[0]; - string iconFileName = Path.GetFileName(iconPath); + + string fileExt = Path.GetExtension(iconPath); + string iconFileName = Path.GetFileNameWithoutExtension(iconPath); string timestamp = DateTime.Now.ToString("yyyyMMddHHmmss"); - matchingFile.AppDescriptor.IconName = $"{iconFileName}_{timestamp}"; + matchingFile.AppDescriptor.IconName = $"{iconFileName}_{timestamp}{fileExt}"; string base64EncodedIcon = Convert.ToBase64String(_fileSystem.File.ReadAllBytes(iconPath)); matchingFile.AppDescriptor.Icon = base64EncodedIcon;