Enhancement: improve try to prune trailing slashes (#4783)

This commit is contained in:
shamoon 2025-02-17 21:44:52 -08:00 committed by GitHub
parent 48e2c494eb
commit a5bdfd92d7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -2,10 +2,13 @@ export function formatApiCall(url, args) {
const find = /\{.*?\}/g;
const replace = (match) => {
const key = match.replace(/\{|\}/g, "");
if (key === "url") {
args[key] = args[key].replace(/\/+$/, ""); // remove trailing slashes
}
return args[key] || "";
};
return url.replace(/\/+$/, "").replace(find, replace).replace(find, replace);
return url.replace(find, replace).replace(find, replace);
}
export function getURLSearchParams(widget, endpoint) {