urlEncode encodes a string so that it is a valid URL We don't use any of Go's standard methods as we need `/` not encoded but we need '&' encoded.
(str string)
| 1515 | // We don't use any of Go's standard methods as we need `/` not |
| 1516 | // encoded but we need '&' encoded. |
| 1517 | func urlEncode(str string) string { |
| 1518 | var buf bytes.Buffer |
| 1519 | for i := range len(str) { |
| 1520 | c := str[i] |
| 1521 | if (c >= '0' && c <= '9') || (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') || c == '/' || c == '.' || c == '_' || c == '-' { |
| 1522 | _ = buf.WriteByte(c) |
| 1523 | } else { |
| 1524 | _, _ = buf.WriteString(fmt.Sprintf("%%%02X", c)) |
| 1525 | } |
| 1526 | } |
| 1527 | return buf.String() |
| 1528 | } |
| 1529 | |
| 1530 | // updateChunks updates the existing object using chunks to a separate |
| 1531 | // container. |
searching dependent graphs…