MCPcopy
hub / github.com/minio/minio-go / QueryEncode

Function QueryEncode

pkg/s3utils/utils.go:294–316  ·  view source on GitHub ↗

QueryEncode - encodes query values in their URL encoded form. In addition to the percent encoding performed by urlEncodePath() used here, it also percent encodes '/' (forward slash)

(v url.Values)

Source from the content-addressed store, hash-verified

292// addition to the percent encoding performed by urlEncodePath() used
293// here, it also percent encodes '/' (forward slash)
294func QueryEncode(v url.Values) string {
295 if v == nil {
296 return ""
297 }
298 var buf bytes.Buffer
299 keys := make([]string, 0, len(v))
300 for k := range v {
301 keys = append(keys, k)
302 }
303 sort.Strings(keys)
304 for _, k := range keys {
305 vs := v[k]
306 prefix := percentEncodeSlash(EncodePath(k)) + "="
307 for _, v := range vs {
308 if buf.Len() > 0 {
309 buf.WriteByte('&')
310 }
311 buf.WriteString(prefix)
312 buf.WriteString(percentEncodeSlash(EncodePath(v)))
313 }
314 }
315 return buf.String()
316}
317
318// if object matches reserved string, no need to encode them
319var reservedObjectNames = regexp.MustCompile("^[a-zA-Z0-9-_.~/]+$")

Callers 3

makeTargetURLMethod · 0.92
PreSignV2Function · 0.92
TestQueryEncodeFunction · 0.85

Calls 4

percentEncodeSlashFunction · 0.85
EncodePathFunction · 0.85
LenMethod · 0.80
StringMethod · 0.45

Tested by 1

TestQueryEncodeFunction · 0.68