Skip to content

Commit

Permalink
Escape resource ID in API request path
Browse files Browse the repository at this point in the history
It looks like client.DoAndGetResponseBody is not working as expected
when id param contains `/`.

Example:
* Method: GET
* URI: platform/15/protocols/nfs/aliases
* ID: /example-nfs-alias

* Expected: Request sent against `/platform/15/protocols/nfs/aliases/%2Fexample-nfs-alias`
* Actual: Request sent against `/platform/15/protocols/nfs/aliases//example-nfs-alias`
  • Loading branch information
shield-9 committed Apr 26, 2024
1 parent 02b996b commit e8bd4ec
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion api/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -450,7 +450,7 @@ func (c *client) DoAndGetResponseBody(
}

if lid > 0 {
ubf.WriteString(id)
ubf.WriteString(url.PathEscape(id))
}

// add parameters to the URI
Expand Down

0 comments on commit e8bd4ec

Please sign in to comment.