t3chnoboy / amazon-product-api

:credit_card: Amazon Product Advertising API client
365 stars 104 forks source link

[Bug] When usign * in the power prop for ItemSearch sig is invalid #121

Open webnoob opened 4 years ago

webnoob commented 4 years ago

Given a power param of:

power: 'binding:kindle and author-exact:' + author + '*',

The code in utils runs:

unsignedString = Object.keys(params).map(function (key) {
    return key + "=" + encodeURIComponent(params[key]).replace(/[!'()*]/g, function(c) {
      return '%' + c.charCodeAt(0).toString(16);
    });
  }).join("&")

Which results in the asterisk being converted into %2a which is technically correct. The issue is that amazon calculates it as %2A (notice the caps) and in turn the sig doesn't validate.