Skip to content
Permalink
Browse files Browse the repository at this point in the history
fix: convert '\' to '/' on windows (#16852)
  • Loading branch information
harshavardhana committed Mar 20, 2023
1 parent 67f4ba1 commit 8d6558b
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion cmd/generic-handlers.go
Expand Up @@ -22,6 +22,7 @@ import (
"net"
"net/http"
"path"
"path/filepath"
"runtime/debug"
"strings"
"sync/atomic"
Expand Down Expand Up @@ -349,7 +350,7 @@ func hasBadHost(host string) error {
// Check if the incoming path has bad path components,
// such as ".." and "."
func hasBadPathComponent(path string) bool {
path = strings.TrimSpace(path)
path = filepath.ToSlash(strings.TrimSpace(path)) // For windows '\' must be converted to '/'
for _, p := range strings.Split(path, SlashSeparator) {
switch strings.TrimSpace(p) {
case dotdotComponent:
Expand Down

0 comments on commit 8d6558b

Please sign in to comment.