mirror of
https://github.com/minio/minio.git
synced 2025-11-09 21:49:46 -05:00
log: Dump signature request properly. (#4063)
Currently percent encoded strings are not properly encoded. `s3%!!(MISSING)A(MISSING)` Print properly as json encoded. `s3%3AObjectCreated%3A%2A`
This commit is contained in:
14
cmd/utils.go
14
cmd/utils.go
@@ -18,6 +18,7 @@ package cmd
|
||||
|
||||
import (
|
||||
"encoding/base64"
|
||||
"encoding/json"
|
||||
"encoding/xml"
|
||||
"errors"
|
||||
"fmt"
|
||||
@@ -28,8 +29,6 @@ import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"encoding/json"
|
||||
|
||||
humanize "github.com/dustin/go-humanize"
|
||||
"github.com/pkg/profile"
|
||||
)
|
||||
@@ -248,12 +247,15 @@ func dumpRequest(r *http.Request) string {
|
||||
Path string `json:"path"`
|
||||
Query string `json:"query"`
|
||||
Header http.Header `json:"header"`
|
||||
}{r.Method, r.URL.Path, r.URL.RawQuery, header}
|
||||
jsonBytes, err := json.Marshal(req)
|
||||
}{r.Method, getURLEncodedName(r.URL.Path), r.URL.RawQuery, header}
|
||||
jsonBytes, err := json.Marshal(&req)
|
||||
if err != nil {
|
||||
return "<error dumping request>"
|
||||
// Upon error just return Go-syntax representation of the value
|
||||
return fmt.Sprintf("%#v", req)
|
||||
}
|
||||
return string(jsonBytes)
|
||||
// Replace all '%' to '%%' so that printer format parser
|
||||
// to ignore URL encoded values.
|
||||
return strings.Replace(string(jsonBytes), "%", "%%", -1)
|
||||
}
|
||||
|
||||
// isFile - returns whether given path is a file or not.
|
||||
|
||||
Reference in New Issue
Block a user