修改路径

This commit is contained in:
2023-05-18 15:09:46 +08:00
parent 53d29fe79d
commit 0e165a196c
3 changed files with 31 additions and 21 deletions
@@ -59,20 +59,20 @@ namespace IRaCIS.Core.API
#region
var defaultFileProvider = new PhysicalFileProvider(iRaCISDefaultDataFolder);
//var defaultFileProvider = new PhysicalFileProvider(iRaCISDefaultDataFolder);
var staticFileOptions = new StaticFileOptions
{
FileProvider = defaultFileProvider,
RequestPath = $"/{StaticData.Folder.IRaCISDataFolder}",
ServeUnknownFileTypes = true,
DefaultContentType = "application/octet-stream"
};
//var staticFileOptions = new StaticFileOptions
//{
// FileProvider = defaultFileProvider,
// RequestPath = $"/{StaticData.Folder.IRaCISDataFolder}",
// ServeUnknownFileTypes = true,
// DefaultContentType = "application/octet-stream"
//};
var a = defaultFileProvider.GetFileInfo(context.Request.Path).Exists;
//var a = defaultFileProvider.GetFileInfo(context.Request.Path).Exists;
var staticFileMiddleware = new StaticFileMiddleware(_next, _hostingEnv, Options.Create(staticFileOptions), _loggerFactory);
await staticFileMiddleware.Invoke(context);
//var staticFileMiddleware = new StaticFileMiddleware(_next, _hostingEnv, Options.Create(staticFileOptions), _loggerFactory);
//await staticFileMiddleware.Invoke(context);
#endregion
@@ -80,17 +80,18 @@ namespace IRaCIS.Core.API
#region wwwroot ...
//var defaultFileProvider = new PhysicalFileProvider(FileStoreHelper.GetIRaCISRootPath(_hostingEnv));
var defaultFileProvider = new PhysicalFileProvider(FileStoreHelper.GetIRaCISRootPath(_hostingEnv));
//if (defaultFileProvider.GetFileInfo(path.Trim('/')).Exists)
//{
if (defaultFileProvider.GetFileInfo(path).Exists)
{
// var actrualPath = defaultFileProvider.GetFileInfo(context.Request.Path).PhysicalPath;
var actrualPath = defaultFileProvider.GetFileInfo(path).PhysicalPath;
var actrualPath2 = defaultFileProvider.GetFileInfo(path).PhysicalPath;
// await context.Response.SendFileAsync(new PhysicalFileInfo(new FileInfo(actrualPath)));
await context.Response.SendFileAsync(new PhysicalFileInfo(new FileInfo(actrualPath)));
// return;
//}
return;
}
#endregion
}
@@ -122,10 +123,10 @@ namespace IRaCIS.Core.API
if (otherFileProvider.GetFileInfo(context.Request.Path).Exists)
if (otherFileProvider.GetFileInfo(path).Exists)
{
var actrualPath = otherFileProvider.GetFileInfo(context.Request.Path).PhysicalPath;
var actrualPath = otherFileProvider.GetFileInfo(path).PhysicalPath;
//方式一
await context.Response.SendFileAsync( new PhysicalFileInfo(new FileInfo(actrualPath)));