mirror of
https://github.com/minio/minio.git
synced 2025-11-20 01:50:24 -05:00
fix: add helper for expected path.Clean behavior (#12068)
current usage of path.Clean returns "." for empty strings instead we need `""` string as-is, make relevant changes as needed.
This commit is contained in:
10
cmd/utils.go
10
cmd/utils.go
@@ -687,6 +687,16 @@ func ceilFrac(numerator, denominator int64) (ceil int64) {
|
||||
return
|
||||
}
|
||||
|
||||
// pathClean is like path.Clean but does not return "." for
|
||||
// empty inputs, instead returns "empty" as is.
|
||||
func pathClean(p string) string {
|
||||
cp := path.Clean(p)
|
||||
if cp == "." {
|
||||
return ""
|
||||
}
|
||||
return cp
|
||||
}
|
||||
|
||||
func trimLeadingSlash(ep string) string {
|
||||
if len(ep) > 0 && ep[0] == '/' {
|
||||
// Path ends with '/' preserve it
|
||||
|
||||
Reference in New Issue
Block a user