gdarko / digital-license-manager

Extendable License Manager for WordPress and WooCommerce 🔑
https://wordpress.org/plugins/digital-license-manager/
GNU General Public License v3.0
23 stars 5 forks source link

Issue with Special Characters #38

Closed SjogrenDev closed 3 months ago

SjogrenDev commented 11 months ago

Hello,

I’ve encountered an issue while utilizing your plugin’s REST API endpoints, specifically when interacting with the “/licenses/{license_key}” endpoints. It appears that when the {license_key} contains certain special characters such as ‘@’, ‘/’, or others, it disrupts the API request flow, leading to an unexpected error:

{
  code: 'rest_no_route',
  message: 'No route was found matching the URL and request method.',
  data: { status: 404 }
}

Steps to Reproduce:

Use a {license_key} containing special characters like ‘@’, ‘/’, etc. Make a request to any of the “licenses/{license_key}” endpoints via the REST API.

Expected Behavior:

The API should be able to process requests with {license_key} values containing special characters without encountering routing or handling issues.

Additional Notes:

I attempted to address this by using encodeURIComponent() to encode the special characters within the {license_key} before making the request. However, the issue persisted.

gdarko commented 11 months ago

Hey @PunisherDev -

Thanks for reporting the issue.

I will work to reproduce and fix it in the coming release.

Best Regards, Darko

gdarko commented 11 months ago

Hey @PunisherDev -

I had a look at the issue.

The problem is that we can not support / characters because those are reserved for the url delimiter. Isn't it possible to exclude those special characters from the generator character set?

Best, Darko

SjogrenDev commented 11 months ago

Hey @PunisherDev -

I had a look at the issue.

The problem is that we can not support / characters because those are reserved for the url delimiter. Isn't it possible to exclude those special characters from the generator character set?

Best, Darko

Hi @gdarko,

Seems like other symbols such as @ also break it. I guess you could start using query parameters instead so it would not cause issues.

I don't personally use your plugin, I just develop addons for it using your API. I heard that some of my clients are having issues as their license keys include the special characters. Most people use it to sell digital licenses not generated by themselves so they don't have control over the key format.

gdarko commented 7 months ago

Hey @SjogrenDev -

We recently added some stuff for dealing with "Complex" keys.

Please check this:

https://docs.codeverve.com/digital-license-manager/rest-api/complex-licenses/

Hopefully this will resolve the issues you had and some other users reported.

Best Regards, Darko

gdarko commented 3 months ago

Closing as complete. The above reply explains how to fix this problem.