|
@@ -1,5 +1,6 @@
|
|
|
using FileStorage.Extensions;
|
|
|
using Microsoft.AspNetCore.StaticFiles;
|
|
|
+using Microsoft.Extensions.Logging;
|
|
|
using Microsoft.Extensions.Options;
|
|
|
using XF.Domain.Dependency;
|
|
|
using XF.Domain.Exceptions;
|
|
@@ -11,11 +12,13 @@ public class DefaultFileStorage : IFileStorage, IScopeDependency
|
|
|
|
|
|
private readonly IFileMetadataRepository _fileMetadataRepository;
|
|
|
private readonly IOptionsSnapshot<StorageConfiguration> _fileUploadOptions;
|
|
|
+ private readonly ILogger<DefaultFileStorage> _logger;
|
|
|
|
|
|
- public DefaultFileStorage(IFileMetadataRepository fileMetadataRepository, IOptionsSnapshot<StorageConfiguration> optionsSnapshot)
|
|
|
+ public DefaultFileStorage(IFileMetadataRepository fileMetadataRepository, IOptionsSnapshot<StorageConfiguration> optionsSnapshot, ILogger<DefaultFileStorage> logger)
|
|
|
{
|
|
|
_fileMetadataRepository = fileMetadataRepository;
|
|
|
_fileUploadOptions = optionsSnapshot;
|
|
|
+ _logger = logger;
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
@@ -190,11 +193,13 @@ public class DefaultFileStorage : IFileStorage, IScopeDependency
|
|
|
string pathHeader = groupDir;
|
|
|
|
|
|
string fulldir = GetFullPath(pathHeader);
|
|
|
+
|
|
|
+ _logger.LogInformation("路径:"+fulldir);
|
|
|
if (!Directory.Exists(fulldir))
|
|
|
{
|
|
|
Directory.CreateDirectory(fulldir);
|
|
|
}
|
|
|
-
|
|
|
+ _logger.LogInformation("已执行");
|
|
|
var ext = string.Empty;
|
|
|
if (!string.IsNullOrEmpty(fileName))
|
|
|
{
|