Skip to content
This repository was archived by the owner on Feb 13, 2026. It is now read-only.

Commit 8d6558b

Browse files
fix: convert '\' to '/' on windows (#16852)
1 parent 67f4ba1 commit 8d6558b

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

cmd/generic-handlers.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import (
2222
"net"
2323
"net/http"
2424
"path"
25+
"path/filepath"
2526
"runtime/debug"
2627
"strings"
2728
"sync/atomic"
@@ -349,7 +350,7 @@ func hasBadHost(host string) error {
349350
// Check if the incoming path has bad path components,
350351
// such as ".." and "."
351352
func hasBadPathComponent(path string) bool {
352-
path = strings.TrimSpace(path)
353+
path = filepath.ToSlash(strings.TrimSpace(path)) // For windows '\' must be converted to '/'
353354
for _, p := range strings.Split(path, SlashSeparator) {
354355
switch strings.TrimSpace(p) {
355356
case dotdotComponent:

0 commit comments

Comments
 (0)