Verified Commit 02b61fdd authored by A. Wilcox's avatar A. Wilcox Committed by A. Wilcox

Etsy: Encode shipping profile name before using.

This fixes a bug reported by two customers.
parent 4e140c0a
......@@ -957,6 +957,7 @@ libAPI bool EtsySite::createShippingProfile(const char *name, uint64_t origin,
char *endpoint = NULL;
char *country_region = NULL;
char *encoded_name = URLEncode(name);
if(entries.at(0)->dest_country != 0)
{
......@@ -973,7 +974,7 @@ libAPI bool EtsySite::createShippingProfile(const char *name, uint64_t origin,
asprintf(&endpoint, "shipping/templates?title=%s&origin_country_id=%llu\
&primary_cost=%0.02f&secondary_cost=%0.02f%s",
name,
encoded_name,
origin,
entries.at(0)->primary_cost,
entries.at(0)->secondary_cost,
......@@ -981,6 +982,7 @@ libAPI bool EtsySite::createShippingProfile(const char *name, uint64_t origin,
if(endpoint == NULL)
alloc_error("shipping template URL", 50);
free(encoded_name);
free(country_region);
JSONNode *profile_node = this->write_to(endpoint, NULL, true);
......@@ -1007,10 +1009,12 @@ libAPI bool EtsySite::changeShippingProfileName(EtsyShippingProfile *profile,
REQUIRES_AUTH
char *endpoint = NULL;
char *encoded_name = URLEncode(name);
asprintf(&endpoint, "shipping/templates/%llu?title=%s",
profile->getID(),
name);
encoded_name);
if(endpoint == NULL) alloc_error("shipping template update URL", 20);
free(encoded_name);
JSONNode *result = this->put_at(endpoint, NULL, true);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment