appsrv: 反转义path segs

支持"climc network-delete 中文"
This commit is contained in:
Yousong Zhou
2019-08-22 08:26:04 +00:00
parent 065f4390c0
commit d8dc6aeb0e
+6
View File
@@ -21,6 +21,7 @@ import (
"math/rand"
"net"
"net/http"
"net/url"
"os"
"strings"
"sync"
@@ -234,6 +235,11 @@ func (app *Application) handleCORS(w http.ResponseWriter, r *http.Request) bool
func (app *Application) defaultHandle(w http.ResponseWriter, r *http.Request, rid string) (*SHandlerInfo, *SAppParams) {
segs := SplitPath(r.URL.EscapedPath())
for i := range segs {
if p, err := url.PathUnescape(segs[i]); err == nil {
segs[i] = p
}
}
params := make(map[string]string)
w.Header().Set("Server", "Yunion AppServer/Go/2018.4")
w.Header().Set("X-Frame-Options", "SAMEORIGIN")