Skip to content

Commit cc9de46

Browse files
Fix path trimming in .NET Core AspNetFileSystem
Trimming should handle forward as well as backslashes. There aren't any unit tests for this already that I could find, so I verified manually by calling: .AddScriptWithoutTransform("~/Content/*.js"); Within the .NET Core sample project. Fixes #526
1 parent 37bac34 commit cc9de46

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/React.AspNet.Middleware/AspNetFileSystem.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ public override string MapPath(string relativePath)
3838
{
3939
return relativePath;
4040
}
41-
relativePath = relativePath.TrimStart('~').TrimStart('/');
41+
relativePath = relativePath.TrimStart('~').TrimStart('/').TrimStart('\\');
4242

4343
return Path.GetFullPath(Path.Combine(_hostingEnv.WebRootPath, relativePath));
4444
}

src/React.Core/FileSystemBase.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ abstract public class FileSystemBase : IFileSystem
3030
public abstract string MapPath(string relativePath);
3131

3232
/// <summary>
33-
/// Converts a path from a full filesystem path to anan application relative path (~/...)
33+
/// Converts a path from a full filesystem path to an application relative path (~/...)
3434
/// </summary>
3535
/// <param name="absolutePath">Full path of the file</param>
3636
/// <returns>App-relative path of the file</returns>

0 commit comments

Comments
 (0)