Change: preserve trailing slash in custom api calls (#5410)
Some checks failed
Docker CI / Linting Checks (push) Has been cancelled
Docker CI / Docker Build & Push (push) Has been cancelled
Crowdin Action / Crowdin Sync (push) Has been cancelled
Repository Maintenance / Stale (push) Has been cancelled
Repository Maintenance / Lock Old Threads (push) Has been cancelled
Repository Maintenance / Close Answered Discussions (push) Has been cancelled
Repository Maintenance / Close Outdated Discussions (push) Has been cancelled
Repository Maintenance / Close Unsupported Feature Requests (push) Has been cancelled

This commit is contained in:
shamoon
2025-06-10 16:02:48 -07:00
committed by GitHub
parent a64c83209a
commit 6e16adc460

View File

@@ -19,9 +19,11 @@ export default async function genericProxyHandler(req, res, map) {
if (widget) { if (widget) {
// if there are more than one question marks, replace others to & // if there are more than one question marks, replace others to &
const url = new URL( let urlString = formatApiCall(widgets[widget.type].api, { endpoint, ...widget }).replace(/(?<=\?.*)\?/g, "&");
formatApiCall(widgets[widget.type].api, { endpoint, ...widget }).replace(/(?<=\?.*)\?/g, "&"), if (widget.type === "customapi" && widget.url?.endsWith("/")) {
); urlString += "/"; // Ensure we dont lose the trailing slash for custom API calls
}
const url = new URL(urlString);
const headers = req.extraHeaders ?? widget.headers ?? widgets[widget.type].headers ?? {}; const headers = req.extraHeaders ?? widget.headers ?? widgets[widget.type].headers ?? {};