修复合并URL中多余分隔符时导致参数发生变化的Bug

This commit is contained in:
GoEdgeLab
2021-11-24 15:01:06 +08:00
parent aa9ce4e260
commit ac33339689
2 changed files with 9 additions and 1 deletions

View File

@@ -9,6 +9,10 @@ func CleanPath(path string) string {
result := []byte{'/'}
isSlash := true
for i := 0; i < l; i++ {
if path[i] == '?' {
result = append(result, path[i:]...)
break
}
if path[i] == '\\' || path[i] == '/' {
if !isSlash {
isSlash = true
@@ -21,4 +25,3 @@ func CleanPath(path string) string {
}
return string(result)
}