Browse Source

Merge pull request #20764 from abpframework/AbpMvcLibsService

Skip check libs if `WebRootPath` is not set.
pull/20770/head
liangshiwei 2 years ago
committed by GitHub
parent
commit
e45d0af6f0
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 9
      framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Libs/AbpMvcLibsService.cs

9
framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Libs/AbpMvcLibsService.cs

@ -74,7 +74,14 @@ public class AbpMvcLibsService : IAbpMvcLibsService, ITransientDependency
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())
{

Loading…
Cancel
Save