Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sub categories showing 404 #85

Open
wants to merge 12 commits into
base: master
Choose a base branch
from
20 changes: 19 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -809,6 +809,23 @@ class Client {
return this.hostname;
}

recursiveURIDecode(url) {
let decodedUrl;
try {
decodedUrl = decodeURI(url);
} catch (error) {
console.error("Error decoding URL:", error);
// Return the original URL if decoding fails
return url;
}

if (decodedUrl === url) {
// Base case: URL is completely decoded
return decodedUrl;
}
// Recursive case: Continue decoding until fully decoded
return this.recursiveURIDecode(decodedUrl);
}
/**
* @external Response
* @see https://github.com/request/request-promise
Expand Down Expand Up @@ -890,10 +907,11 @@ class Client {

nativeRequest(path, opts) {
const uri = this.baseUrl + path;
const decodedUrl = this.recursiveURIDecode(uri);
const params = Object.assign(
{
method: "GET",
uri: uri,
uri: encodeURI(decodedUrl),
json: true,
gzip: true
},
Expand Down
Loading