MCPcopy Create free account
hub / github.com/OpenHands/OpenHands / stripBasePathFromUrl

Function stripBasePathFromUrl

scripts/static-server.mjs:440–447  ·  view source on GitHub ↗
(rawUrl, basePath)

Source from the content-addressed store, hash-verified

438}
439
440function stripBasePathFromUrl(rawUrl, basePath) {
441 if (basePath === "/") return rawUrl;
442
443 const [rawPath = "/", ...rest] = (rawUrl || "/").split("?");
444 const suffix = rawPath.slice(basePath.length) || "/";
445 const path = suffix.startsWith("/") ? suffix : `/${suffix}`;
446 return rest.length > 0 ? `${path}?${rest.join("?")}` : path;
447}
448
449function redirectToMountedPath(req, res, urlPath, basePath) {
450 if (basePath === "/" || !isGetOrHead(req) || looksLikeAssetRequest(urlPath)) {

Callers 1

handleStaticFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected