修改路径
This commit is contained in:
+21
-20
@@ -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)));
|
||||
|
||||
Reference in New Issue
Block a user