Skip to content

Commit

Permalink
filename fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Kirill Krylo committed Sep 13, 2024
1 parent 83b8a3e commit 3e4be5a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ const string expectedFilePath
string appDescriptorContent = FileSystem.File.ReadAllText(expectedFilePath);

AppDescriptorJson appDescriptor = JsonConvert.DeserializeObject<AppDescriptorJson>(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);
}
Expand Down
6 changes: 4 additions & 2 deletions clio/ComposableApplication/ComposableApplicationManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 3e4be5a

Please sign in to comment.