Skip to content

Commit

Permalink
add more comment to clarify element indexing
Browse files Browse the repository at this point in the history
  • Loading branch information
Tianyi Wang committed Nov 13, 2024
1 parent 81a281d commit 963a036
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
8 changes: 8 additions & 0 deletions .changelog/3efb0d073e5544c2a9b84abdab930700.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"id": "3efb0d07-3e55-44c2-a9b8-4abdab930700",
"type": "bugfix",
"description": "Fix the uri path element replace issue caused by prefix overlap",
"modules": [
"."
]
}
1 change: 1 addition & 0 deletions encoding/httpbinding/path_replace.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ func bufCap(b []byte, n int) []byte {
// replacePathElement replaces a single element in the path []byte.
// Escape is used to control whether the value will be escaped using Amazon path escape style.
func replacePathElement(path, fieldBuf []byte, key, val string, escape bool) ([]byte, []byte, error) {
// search for "{<key>}". If not found, search for the greedy version "{<key>+}". If none are found, return error
fieldBuf = bufCap(fieldBuf, len(key)+2) // { <key> }
fieldBuf = append(fieldBuf, uriTokenStart)
fieldBuf = append(fieldBuf, key...)
Expand Down

0 comments on commit 963a036

Please sign in to comment.