Skip to content

Commit

Permalink
Merge pull request #20764 from abpframework/AbpMvcLibsService
Browse files Browse the repository at this point in the history
Skip check libs if `WebRootPath` is not set.
  • Loading branch information
realLiangshiwei authored Sep 9, 2024
2 parents 3982ebf + 544e24d commit e45d0af
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 e45d0af

Please sign in to comment.