diff --git a/src/React.AspNet/AspNetFileSystem.cs b/src/React.AspNet/AspNetFileSystem.cs index 7e0e64f2d..4781a4fa5 100644 --- a/src/React.AspNet/AspNetFileSystem.cs +++ b/src/React.AspNet/AspNetFileSystem.cs @@ -36,8 +36,12 @@ public AspNetFileSystem(IHostingEnvironment hostingEnv) /// Full path of the file public override string MapPath(string relativePath) { - relativePath = relativePath.TrimStart('~').TrimStart('/'); - return Path.Combine(_hostingEnv.WebRootPath, relativePath); + if (relativePath.StartsWith(_hostingEnv.WebRootPath)) + { + return relativePath; + } + relativePath = relativePath.TrimStart('~').TrimStart('/'); + return Path.Combine(_hostingEnv.WebRootPath, relativePath); } } }