Skip to content

Commit

Permalink
add support for Windows filepath in fs handlers
Browse files Browse the repository at this point in the history
  • Loading branch information
Landryna committed Sep 19, 2021
1 parent 44d0333 commit 4b3460a
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions fs.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (
"net/http"
"os"
"path/filepath"
"runtime"
"sort"
"strings"
"sync"
Expand Down Expand Up @@ -794,6 +795,10 @@ func (h *fsHandler) handleRequest(ctx *RequestCtx) {
if !ok {
pathStr := string(path)
filePath := h.root + pathStr
switch runtime.GOOS {
case "windows":
filePath = filepath.FromSlash(filePath)
}
var err error
ff, err = h.openFSFile(filePath, mustCompress, fileEncoding)
if mustCompress && err == errNoCreatePermission {
Expand Down

0 comments on commit 4b3460a

Please sign in to comment.