修改文档上传后不能查看

This commit is contained in:
2023-05-18 14:32:27 +08:00
parent 84ccbe3ac0
commit 2854acf146
2 changed files with 27 additions and 9 deletions
@@ -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;
}
}
//没找到