Skip to content

Commit

Permalink
Implemented what was described by me in #1766. (#1767)
Browse files Browse the repository at this point in the history
* Implemented what was described by me in issue#1766.

* fixed linting isssues in fs.go with gofmt -e -d -s

---------

Co-authored-by: Raphael Habichler <[email protected]>
  • Loading branch information
rhabichl and Raphael Habichler authored Apr 29, 2024
1 parent 105eb3b commit 091733b
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions fs.go
Original file line number Diff line number Diff line change
Expand Up @@ -1233,6 +1233,12 @@ func (h *fsHandler) openIndexFile(ctx *RequestCtx, dirPath string, mustCompress
if err == nil {
return ff, nil
}
if mustCompress && err == errNoCreatePermission {
ctx.Logger().Printf("insufficient permissions for saving compressed file for %q. Serving uncompressed file. "+
"Allow write access to the directory with this file in order to improve fasthttp performance", indexFilePath)
mustCompress = false
return h.openFSFile(indexFilePath, mustCompress, fileEncoding)
}
if !errors.Is(err, fs.ErrNotExist) {
return nil, fmt.Errorf("cannot open file %q: %w", indexFilePath, err)
}
Expand Down

0 comments on commit 091733b

Please sign in to comment.