fix: close file

pull/401/head
guangwu 11 months ago committed by GitHub
parent 53db5562b4
commit 80ad7deacd
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -270,6 +270,7 @@ func (e *exportImport) ExportMarkdown(ctx context.Context, needFrontMatter bool)
if err != nil { if err != nil {
return "", xerr.WithStatus(err, xerr.StatusInternalServerError).WithMsg("create file err") return "", xerr.WithStatus(err, xerr.StatusInternalServerError).WithMsg("create file err")
} }
defer file.Close()
_, err = file.WriteString(markdown.String()) _, err = file.WriteString(markdown.String())
if err != nil { if err != nil {
return "", xerr.WithStatus(err, xerr.StatusInternalServerError).WithMsg("write file err") return "", xerr.WithStatus(err, xerr.StatusInternalServerError).WithMsg("write file err")

Loading…
Cancel
Save