Skip to content

Commit

Permalink
Skip check libs if WebRootPath is not set.
Browse files Browse the repository at this point in the history
  • Loading branch information
maliming committed Sep 7, 2024
1 parent 3982ebf commit 544e24d
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,14 @@ protected virtual Task<bool> CheckLibsAsync(HttpContext httpContext)
var logger = httpContext.RequestServices.GetRequiredService<ILogger<AbpMvcLibsService>>();
try
{
var fileProvider = new PhysicalFileProvider(httpContext.RequestServices.GetRequiredService<IWebHostEnvironment>().WebRootPath);
var webHostEnvironment = httpContext.RequestServices.GetRequiredService<IWebHostEnvironment>();
if (webHostEnvironment.WebRootPath.IsNullOrWhiteSpace())
{
logger.LogWarning("The 'WebRootPath' is not set! The 'CheckLibs' feature is disabled!");
return Task.FromResult(true);
}

var fileProvider = new PhysicalFileProvider(webHostEnvironment.WebRootPath);
var libsFolder = fileProvider.GetDirectoryContents("/libs");
if (!libsFolder.Exists || !libsFolder.Any())
{
Expand Down

0 comments on commit 544e24d

Please sign in to comment.