mirror of
https://github.com/minio/minio.git
synced 2025-03-31 09:43:43 -04:00
fix: convert '\' to '/' on windows (#16852)
This commit is contained in:
parent
67f4ba154a
commit
8d6558b236
@ -22,6 +22,7 @@ import (
|
|||||||
"net"
|
"net"
|
||||||
"net/http"
|
"net/http"
|
||||||
"path"
|
"path"
|
||||||
|
"path/filepath"
|
||||||
"runtime/debug"
|
"runtime/debug"
|
||||||
"strings"
|
"strings"
|
||||||
"sync/atomic"
|
"sync/atomic"
|
||||||
@ -349,7 +350,7 @@ func hasBadHost(host string) error {
|
|||||||
// Check if the incoming path has bad path components,
|
// Check if the incoming path has bad path components,
|
||||||
// such as ".." and "."
|
// such as ".." and "."
|
||||||
func hasBadPathComponent(path string) bool {
|
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) {
|
for _, p := range strings.Split(path, SlashSeparator) {
|
||||||
switch strings.TrimSpace(p) {
|
switch strings.TrimSpace(p) {
|
||||||
case dotdotComponent:
|
case dotdotComponent:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user