Skip to content

Commit

Permalink
Merge pull request #72 from ignitionrobotics/3_to_4
Browse files Browse the repository at this point in the history
3 ➡️ 4

Signed-off-by: Louise Poubel <[email protected]>
  • Loading branch information
chapulina authored Jun 5, 2020
2 parents c12f929 + 2b372a1 commit 0ded4bf
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
5 changes: 5 additions & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@

### Ignition Fuel Tools 3.x.x (20xx-xx-xx)

### Ignition Fuel Tools 3.2.2 (2020-05-18)

1. Fix URL encodings in RestClient.
* [Pull request 70](https://github.com/ignitionrobotics/ign-fuel-tools/pull/70)

1. Print message when downloading a resource.
* [BitBucket pull request 102](https://osrf-migration.github.io/ignition-gh-pages/#!/ignitionrobotics/ign-fuel-tools/pull-requests/102)

Expand Down
10 changes: 9 additions & 1 deletion src/RestClient.cc
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,15 @@ RestResponse Rest::Request(HttpMethod _method,
std::string url = RestJoinUrl(_url, _version);

CURL *curl = curl_easy_init();
char *encodedPath = curl_easy_escape(curl, _path.c_str(), _path.size());

// First, unescape the _path since it might have %XX encodings. If this
// step is not performed, then curl_easy_escape will encode the %XX
// encodings resulting in an incorrect URL.
int decodedSize;
char *decodedPath = curl_easy_unescape(curl,
_path.c_str(), _path.size(), &decodedSize);

char *encodedPath = curl_easy_escape(curl, decodedPath, decodedSize);
url = RestJoinUrl(url, encodedPath);

// Process query strings.
Expand Down

0 comments on commit 0ded4bf

Please sign in to comment.