Feat: preview shared file

This commit is contained in:
HFO4
2020-01-28 13:40:19 +08:00
parent 7f0feebf42
commit 1ff4d59978
5 changed files with 85 additions and 8 deletions

View File

@@ -218,6 +218,11 @@ func (service *SingleFileService) PreviewContent(ctx context.Context, c *gin.Con
}
defer fs.Recycle()
// 如果上下文中已有File对象则重设目标
if file, ok := ctx.Value(fsctx.FileModelCtx).(*model.File); ok {
fs.SetTargetFile(&[]model.File{*file})
}
// 获取文件预览响应
resp, err := fs.Preview(ctx, service.Path, isText)
if err != nil {