mirror of
https://github.com/karl0ss/homepage.git
synced 2025-04-29 12:03:41 +01:00
Enhancement: improve try to prune trailing slashes (#4783)
This commit is contained in:
parent
48e2c494eb
commit
a5bdfd92d7
@ -2,10 +2,13 @@ export function formatApiCall(url, args) {
|
|||||||
const find = /\{.*?\}/g;
|
const find = /\{.*?\}/g;
|
||||||
const replace = (match) => {
|
const replace = (match) => {
|
||||||
const key = match.replace(/\{|\}/g, "");
|
const key = match.replace(/\{|\}/g, "");
|
||||||
|
if (key === "url") {
|
||||||
|
args[key] = args[key].replace(/\/+$/, ""); // remove trailing slashes
|
||||||
|
}
|
||||||
return args[key] || "";
|
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) {
|
export function getURLSearchParams(widget, endpoint) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user