修改文档上传后不能查看
This commit is contained in:
+27
-7
@@ -54,7 +54,12 @@ namespace IRaCIS.Core.API
|
||||
//先从默认里面去找
|
||||
if (isIRacisFile)
|
||||
{
|
||||
var defaultFileProvider = new PhysicalFileProvider(FileStoreHelper.GetIRaCISRootPath(_hostingEnv));
|
||||
|
||||
|
||||
|
||||
#region 方式二
|
||||
|
||||
var defaultFileProvider = new PhysicalFileProvider(iRaCISDefaultDataFolder);
|
||||
|
||||
var staticFileOptions = new StaticFileOptions
|
||||
{
|
||||
@@ -64,15 +69,30 @@ namespace IRaCIS.Core.API
|
||||
DefaultContentType = "application/octet-stream"
|
||||
};
|
||||
|
||||
if (defaultFileProvider.GetFileInfo(context.Request.Path).Exists)
|
||||
{
|
||||
var a = defaultFileProvider.GetFileInfo(context.Request.Path).Exists;
|
||||
|
||||
var actrualPath = defaultFileProvider.GetFileInfo(context.Request.Path).PhysicalPath;
|
||||
var staticFileMiddleware = new StaticFileMiddleware(_next, _hostingEnv, Options.Create(staticFileOptions), _loggerFactory);
|
||||
await staticFileMiddleware.Invoke(context);
|
||||
|
||||
await context.Response.SendFileAsync(new PhysicalFileInfo(new FileInfo(actrualPath)));
|
||||
#endregion
|
||||
|
||||
|
||||
|
||||
#region 文档上传默认会加wwwroot 奇怪...
|
||||
|
||||
//var defaultFileProvider = new PhysicalFileProvider(FileStoreHelper.GetIRaCISRootPath(_hostingEnv));
|
||||
|
||||
//if (defaultFileProvider.GetFileInfo(path.Trim('/')).Exists)
|
||||
//{
|
||||
|
||||
// var actrualPath = defaultFileProvider.GetFileInfo(context.Request.Path).PhysicalPath;
|
||||
|
||||
// await context.Response.SendFileAsync(new PhysicalFileInfo(new FileInfo(actrualPath)));
|
||||
|
||||
// return;
|
||||
//}
|
||||
#endregion
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
//没找到
|
||||
|
||||
Reference in New Issue
Block a user