Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
efectn committed May 30, 2024
1 parent 6f4c253 commit 954ab45
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 5 deletions.
4 changes: 2 additions & 2 deletions ctx.go
Original file line number Diff line number Diff line change
Expand Up @@ -1453,7 +1453,7 @@ func (c *DefaultCtx) SendFile(file string, config ...SendFile) error {
}

// https://github.com/valyala/fasthttp/blob/c7576cc10cabfc9c993317a2d3f8355497bea156/fs.go#L129-L134
route.sendFileOnce.Do(func() {
if route.sendFileFS == nil {
route.sendFileFS = &fasthttp.FS{
Root: "",
FS: cfg.FS,
Expand All @@ -1480,7 +1480,7 @@ func (c *DefaultCtx) SendFile(file string, config ...SendFile) error {
if maxAge > 0 {
route.sendFileCacheControlValue = "public, max-age=" + strconv.Itoa(maxAge)
}
})
}

// Keep original path for mutable params
c.pathOriginal = utils.CopyString(c.pathOriginal)
Expand Down
1 change: 0 additions & 1 deletion ctx_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3041,7 +3041,6 @@ func Test_Ctx_SendFile_Compressed(t *testing.T) {

defer func() {
require.NoError(t, f.Close())

}()
expectFileContent, err := io.ReadAll(f)
require.NoError(t, err)
Expand Down
2 changes: 0 additions & 2 deletions router.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import (
"html"
"sort"
"strings"
"sync"
"sync/atomic"

"github.com/gofiber/utils/v2"
Expand Down Expand Up @@ -62,7 +61,6 @@ type Route struct {
Params []string `json:"params"` // Case sensitive param keys
Handlers []Handler `json:"-"` // Ctx handlers

sendFileOnce sync.Once
sendFileFS *fasthttp.FS
sendFileHandler fasthttp.RequestHandler
sendFileCacheControlValue string
Expand Down

0 comments on commit 954ab45

Please sign in to comment.