Browse Source

Skip check libs if `WebRootPath` is not set.

pull/20764/head
maliming 2 years ago
parent
commit
544e24d85f
No known key found for this signature in database GPG Key ID: A646B9CB645ECEA4
  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