feat(doc preview): add magic variable for file name

This commit is contained in:
HFO4 2022-12-16 16:55:47 +08:00
parent 435a03dd34
commit 9860ebbca9

View file

@ -230,11 +230,13 @@ func (service *FileIDService) CreateDocPreviewSession(ctx context.Context, c *gi
srcB64 := base64.StdEncoding.EncodeToString([]byte(downloadURL)) srcB64 := base64.StdEncoding.EncodeToString([]byte(downloadURL))
srcEncoded := url.QueryEscape(downloadURL) srcEncoded := url.QueryEscape(downloadURL)
srcB64Encoded := url.QueryEscape(srcB64) srcB64Encoded := url.QueryEscape(srcB64)
return serializer.Response{ return serializer.Response{
Code: 0, Code: 0,
Data: util.Replace(map[string]string{ Data: util.Replace(map[string]string{
"{$src}": srcEncoded, "{$src}": srcEncoded,
"{$srcB64}": srcB64Encoded, "{$srcB64}": srcB64Encoded,
"{$name}": url.QueryEscape(fs.FileTarget[0].Name),
}, model.GetSettingByName("office_preview_service")), }, model.GetSettingByName("office_preview_service")),
} }
} }