mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-10-14 02:44:52 +08:00
Bug 17262 Theme: Layout.cshtml has to be uppercase.
Fixing the Template Harvester to be case insensitive --HG-- branch : dev
This commit is contained in:
@@ -9,7 +9,7 @@ namespace Orchard.Tests.DisplayManagement.Descriptors {
|
||||
var harvester = new BasicShapeTemplateHarvester();
|
||||
var harvestShapeHits = harvester.HarvestShape(new HarvestShapeInfo { SubPath = givenSubPath, FileName = givenFileName });
|
||||
Assert.That(harvestShapeHits.Count(), Is.EqualTo(1));
|
||||
Assert.That(harvestShapeHits.Single().ShapeType, Is.EqualTo(expectedShapeType));
|
||||
Assert.That(harvestShapeHits.Single().ShapeType, Is.EqualTo(expectedShapeType).IgnoreCase);
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
@@ -140,7 +140,7 @@ namespace Orchard.Tests.DisplayManagement.Descriptors {
|
||||
strategy.Discover(builder);
|
||||
var alterations = alterationBuilders.Select(alterationBuilder=>alterationBuilder.Build());
|
||||
|
||||
Assert.That(alterations.Any(alteration => alteration.ShapeType == "AlphaShape"));
|
||||
Assert.That(alterations.Any(alteration => alteration.ShapeType.Equals("AlphaShape", StringComparison.OrdinalIgnoreCase)));
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -44,14 +44,14 @@ namespace Orchard.DisplayManagement.Descriptors.ShapeTemplateStrategy {
|
||||
var shapeType = leader + fileName.Replace("--", "__").Replace("-", "__").Replace('.', '_');
|
||||
|
||||
if (string.IsNullOrEmpty(displayType)) {
|
||||
return shapeType;
|
||||
return shapeType.ToLowerInvariant();
|
||||
}
|
||||
var firstBreakingSeparator = shapeType.IndexOf("__");
|
||||
if (firstBreakingSeparator <= 0) {
|
||||
return shapeType + "_" + displayType;
|
||||
return (shapeType + "_" + displayType).ToLowerInvariant();
|
||||
}
|
||||
|
||||
return shapeType.Substring(0, firstBreakingSeparator) + "_" + displayType + shapeType.Substring(firstBreakingSeparator);
|
||||
return (shapeType.Substring(0, firstBreakingSeparator) + "_" + displayType + shapeType.Substring(firstBreakingSeparator)).ToLowerInvariant();
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user