Skip to content

Commit

Permalink
fix for case sensitivity when matching webresources on server, other …
Browse files Browse the repository at this point in the history
…fixes see comments
  • Loading branch information
pagex committed Oct 2, 2020
1 parent 65c01fc commit 9f813db
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -88,12 +88,12 @@ private void DisplayConnections()

foreach (ConnectionDetail detail in details)
{
var item = new ListViewItem(detail.ConnectionName);
var item = new ListViewItem(detail.ConnectionName ?? "No name"); //throws out of memory exception if null
item.SubItems.Add(detail.ServerName);
item.SubItems.Add(detail.Organization);
item.SubItems.Add(string.IsNullOrEmpty(detail.UserDomain) ? detail.UserName : $"{detail.UserDomain}\\{detail.UserName}");
item.SubItems.Add(detail.OrganizationVersion);
item.SubItems.Add(detail.SolutionName);
item.SubItems.Add(detail.SolutionName ?? "No name");
item.Tag = detail;
item.ImageIndex = GetImageIndex(detail);

Expand Down
21 changes: 11 additions & 10 deletions CrmWebResourcesUpdater.Services/Helpers/MappingHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,17 +53,18 @@ public Dictionary<string, string> LoadMappings(Project project)
projectFiles.RemoveAll(x => x.ToLower() == scriptPath);
mappingList.Add(scriptPath, webResourceName);
}
foreach(var mapping in mappingList)
{
var scriptPath = mapping.Key;
var webResourceName = mapping.Value;
var projectMappingDublicates = projectFiles.Where(x => Path.GetFileName(x).ToLower() == webResourceName.ToLower());
if (projectMappingDublicates.Count() > 0)
{
throw new ArgumentException("Project contains dublicate(s) for mapped web resource \"" + webResourceName + "\"");
}
//this bit totally fine when you have mapping for say uitls.js defined in mapping file and file on disk by the same name -> code below was throwing an error
//foreach(var mapping in mappingList)
//{
// var scriptPath = mapping.Key;
// var webResourceName = mapping.Value;
// var projectMappingDublicates = projectFiles.Where(x => Path.GetFileName(x).ToLower() == webResourceName.ToLower());
// if (projectMappingDublicates.Count() > 0)
// {
// throw new ArgumentException("Project contains duplicate(s) for mapped web resource \"" + webResourceName + "\"");
// }

}
//}
return mappingList;
}

Expand Down
6 changes: 5 additions & 1 deletion CrmWebResourcesUpdater.Services/PublishService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -261,8 +261,12 @@ private async Task<Dictionary<Guid, string>> UploadWebResourcesAsync(List<string
var relativePath = lowerFilePath.Replace(projectRootPath + "\\", "");
await Logger.WriteLineAsync("Mapping found: " + relativePath + " to " + webResourceName, connections.ExtendedLog);
}
else
{
await Logger.WriteLineAsync($"Mapping for not found for webresource {webResourceName} trying to find by name", connections.ExtendedLog);
}

var webResource = webResources.FirstOrDefault(x => x.GetAttributeValue<string>("name") == webResourceName);
var webResource = webResources.FirstOrDefault(x => x.GetAttributeValue<string>("name").ToLower() == webResourceName.ToLower());
if(webResource == null && connections.IgnoreExtensions)
{
await Logger.WriteLineAsync(webResourceName + " does not exists in selected solution", connections.ExtendedLog);
Expand Down

0 comments on commit 9f813db

Please sign in to comment.