From 5bf64ee743f060b53f075810c270f3dded91135d Mon Sep 17 00:00:00 2001 From: Janet-Baker <36568027+Janet-Baker@users.noreply.github.com> Date: Sun, 4 Jun 2023 09:56:40 +0800 Subject: [PATCH] Fix #2119 (#2186) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix: 尝试修复 #2070 (#2071) * Close file after uploading it to private chat fix #2119 上传文件到私聊后,释放文件。 --- coolq/api.go | 1 + 1 file changed, 1 insertion(+) diff --git a/coolq/api.go b/coolq/api.go index f54ac67..a1e6fc0 100644 --- a/coolq/api.go +++ b/coolq/api.go @@ -617,6 +617,7 @@ func (bot *CQBot) CQUploadPrivateFile(userID int64, file, name string) global.MS log.Warnf("上传私聊文件 %v 失败: %+v", file, err) return Failed(100, "OPEN_FILE_ERROR", "打开文件失败") } + defer func() { _ = fileBody.Close() }() localFile := &client.LocalFile{ FileName: name, Body: fileBody,