mirror of
https://github.com/halejohn/Cloudreve.git
synced 2026-01-26 09:34:57 +08:00
Modify: close file in main routine
This commit is contained in:
@@ -11,6 +11,7 @@ import (
|
||||
"github.com/HFO4/cloudreve/pkg/util"
|
||||
"github.com/HFO4/cloudreve/service/explorer"
|
||||
"github.com/gin-gonic/gin"
|
||||
"io"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"strconv"
|
||||
@@ -99,6 +100,11 @@ func Thumb(c *gin.Context) {
|
||||
}
|
||||
http.ServeContent(c.Writer, c.Request, "thumb.png", fs.FileTarget[0].UpdatedAt, resp.Content)
|
||||
|
||||
// 检查是否需要关闭文件
|
||||
if fc, ok := resp.Content.(io.Closer); ok {
|
||||
defer fc.Close()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Download 文件下载
|
||||
|
||||
Reference in New Issue
Block a user