Skip to content

Commit 68f3c60

Browse files
Throw detailed exception if wwwroot folder is missing
1 parent 2c0c387 commit 68f3c60

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

src/React.AspNet.Middleware/AspNetFileSystem.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
using System.IO;
99
using Microsoft.AspNetCore.Hosting;
10+
using React.Exceptions;
1011

1112
#if NETCOREAPP2_0 || NETSTANDARD2_0
1213
using IWebHostEnvironment = Microsoft.AspNetCore.Hosting.IHostingEnvironment;
@@ -38,6 +39,11 @@ public AspNetFileSystem(IWebHostEnvironment hostingEnv)
3839
/// <returns>Full path of the file</returns>
3940
public override string MapPath(string relativePath)
4041
{
42+
if (_hostingEnv.WebRootPath == null)
43+
{
44+
throw new ReactException("WebRootPath was null, has the wwwroot folder been deployed along with your app?");
45+
}
46+
4147
if (relativePath.StartsWith(_hostingEnv.WebRootPath))
4248
{
4349
return relativePath;

0 commit comments

Comments
 (0)