mirror of
https://github.com/DI0IK/homepage-plus.git
synced 2025-07-06 20:28:48 +00:00
Enhancement: improve try to prune trailing slashes (#4783)
This commit is contained in:
parent
48e2c494eb
commit
a5bdfd92d7
1 changed files with 4 additions and 1 deletions
|
@ -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) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue