Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 7 additions & 8 deletions internal/aws/escape.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,18 @@ func escapeURIPath(w *bytes.Buffer, uri string) {
var buf [utf8.UTFMax]byte
length := utf8.EncodeRune(buf[:], c)

w.WriteByte('%')
encodeHexUpper(w, buf[:length])
for i := range length {
w.WriteByte('%')
encodeHexUpper(w, buf[i])
}
}
w.WriteString(uri[n:])
}

func encodeHexUpper(w *bytes.Buffer, s []byte) {
func encodeHexUpper(w *bytes.Buffer, b byte) {
const hexUpper = "0123456789ABCDEF"
for i := range s {
b := s[i]
w.WriteByte(hexUpper[b>>4])
w.WriteByte(hexUpper[b&0x0F])
}
w.WriteByte(hexUpper[b>>4])
w.WriteByte(hexUpper[b&0x0F])
}

// mapping of valid uri path bytes.
Expand Down