Skip to content

Commit

Permalink
fix: get file content twice (#2000)
Browse files Browse the repository at this point in the history
  • Loading branch information
Ns2Kracy committed Sep 14, 2024
1 parent e4bf67d commit 8b251dc
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions route/v1/file.go
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,6 @@ func GetDownloadSingleFile(ctx echo.Context) error {
ctx.Request().Header.Add("Content-Length", strconv.FormatInt(node.Size(), 10))
}
http.ServeContent(ctx.Response().Writer, ctx.Request(), fileName, node.ModTime(), fi)
// http.ServeFile(c.Writer, ctx.Request(), filePath)
defer fi.Close()
fileTmp, err := os.Open(filePath)
if err != nil {
Expand All @@ -268,7 +267,7 @@ func GetDownloadSingleFile(ctx echo.Context) error {
}
defer fileTmp.Close()

return ctx.File(filePath)
return nil
}

// @Summary 获取目录列表
Expand Down

0 comments on commit 8b251dc

Please sign in to comment.