Feat: preview shared text/doc file

This commit is contained in:
HFO4
2020-01-29 12:16:52 +08:00
parent 68704f8646
commit 0d7c0793b2
4 changed files with 66 additions and 1 deletions

View File

@@ -128,6 +128,11 @@ func (service *SingleFileService) CreateDocPreviewSession(ctx context.Context, c
}
defer fs.Recycle()
// 如果上下文中已有File对象则重设目标
if file, ok := ctx.Value(fsctx.FileModelCtx).(*model.File); ok {
fs.SetTargetFile(&[]model.File{*file})
}
// 获取文件临时下载地址
downloadURL, err := fs.GetDownloadURL(ctx, service.Path, "doc_preview_timeout")
if err != nil {