From a26183875f1f0c91e5d7f23be4cffde49b015a7e Mon Sep 17 00:00:00 2001 From: HFO4 <912394456@qq.com> Date: Wed, 20 Apr 2022 11:49:01 +0800 Subject: [PATCH] fix: in decompress, file stream should be closed after copy it to temp file. --- assets | 2 +- pkg/filesystem/archive.go | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/assets b/assets index 4ca2d36..9a46182 160000 --- a/assets +++ b/assets @@ -1 +1 @@ -Subproject commit 4ca2d3696b227a55b64aa12fb387e80fec62111a +Subproject commit 9a46182901733f5a7d0f48895302862afc959c7e diff --git a/pkg/filesystem/archive.go b/pkg/filesystem/archive.go index 4468c45..f1bc418 100644 --- a/pkg/filesystem/archive.go +++ b/pkg/filesystem/archive.go @@ -190,6 +190,8 @@ func (fs *FileSystem) Decompress(ctx context.Context, src, dst string) error { return err } + defer fileStream.Close() + tempZipFilePath = filepath.Join( util.RelativePath(model.GetSettingByName("temp_path")), "decompress", @@ -211,6 +213,7 @@ func (fs *FileSystem) Decompress(ctx context.Context, src, dst string) error { } zipFile.Close() + fileStream.Close() // 解压缩文件 r, err := zip.OpenReader(tempZipFilePath)