From 9d250f6bb08ba223dbd8eccc67af9c7ce2472673 Mon Sep 17 00:00:00 2001 From: yamachu Date: Wed, 14 Dec 2016 02:59:57 +0900 Subject: [PATCH] Fixed a problem duplicated relativePath --- src/React.AspNet/AspNetFileSystem.cs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) 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); } } }