Issue #2745 - ViewHierarchyUtility.GetHierarchicalPath does not handle root paths *nix file systems.

Fix: It is not necessary to check for root paths in this place because ViewHierarchyUtility.GetHierarchicalPath is always called with a relative path. Hence removing the check.
This commit is contained in:
sornaks 2015-08-06 10:31:11 -07:00
parent 87c5384390
commit 1aef84b50d
2 changed files with 0 additions and 36 deletions

View File

@ -68,12 +68,6 @@ namespace Microsoft.AspNet.Mvc.Razor
relativePath = relativePath.Substring(1);
}
if (Path.IsPathRooted(relativePath))
{
// If the path looks like it's not app relative, don't attempt to construct paths.
return Enumerable.Empty<string>();
}
if (string.Equals(Path.GetFileName(relativePath), fileName, StringComparison.OrdinalIgnoreCase))
{
// If the specified path is for the file hierarchy being constructed, then the first file that applies

View File

@ -221,35 +221,5 @@ namespace Microsoft.AspNet.Mvc.Razor
// Assert
Assert.Empty(result);
}
[ConditionalTheory]
// https://github.com/aspnet/Mvc/issues/2745
[FrameworkSkipCondition(RuntimeFrameworks.Mono)]
public void GetViewStartLocations_ReturnsEmptySequence_IfPathIsRooted()
{
// Arrange
var absolutePath = Path.Combine(Directory.GetCurrentDirectory(), "Index.cshtml");
// Act
var result = ViewHierarchyUtility.GetViewStartLocations(absolutePath);
// Assert
Assert.Empty(result);
}
[ConditionalTheory]
// https://github.com/aspnet/Mvc/issues/2745
[FrameworkSkipCondition(RuntimeFrameworks.Mono)]
public void GetViewImportsLocations_ReturnsEmptySequence_IfPathIsRooted()
{
// Arrange
var absolutePath = Path.Combine(Directory.GetCurrentDirectory(), "Index.cshtml");
// Act
var result = ViewHierarchyUtility.GetViewImportsLocations(absolutePath);
// Assert
Assert.Empty(result);
}
}
}