Fix: unclosed file after get thumbnails
This commit is contained in:
parent
ee08821361
commit
bf0998f3a5
2 changed files with 2 additions and 4 deletions
|
@ -52,6 +52,7 @@ func (fs *FileSystem) GenerateThumbnail(ctx context.Context, file *model.File) {
|
|||
if err != nil {
|
||||
return
|
||||
}
|
||||
defer source.Close()
|
||||
|
||||
image, err := thumb.NewThumbFromFile(source, file.Name)
|
||||
if err != nil {
|
||||
|
|
|
@ -69,10 +69,7 @@ func (handler Handler) Put(ctx context.Context, file io.ReadCloser, dst string,
|
|||
util.Log().Warning("无法创建文件,%s", err)
|
||||
return err
|
||||
}
|
||||
defer func() {
|
||||
err := out.Close()
|
||||
fmt.Print(err)
|
||||
}()
|
||||
defer out.Close()
|
||||
|
||||
// 写入文件内容
|
||||
_, err = io.Copy(out, file)
|
||||
|
|
Loading…
Reference in a new issue