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

Function stripBasePathFromUrl

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

Source from the content-addressed store, hash-verified

566}
567
568function stripBasePathFromUrl(rawUrl, basePath) {
569 if (basePath === "/") return rawUrl;
570
571 const [rawPath = "/", ...rest] = (rawUrl || "/").split("?");
572 const suffix = rawPath.slice(basePath.length) || "/";
573 const path = suffix.startsWith("/") ? suffix : `/${suffix}`;
574 return rest.length > 0 ? `${path}?${rest.join("?")}` : path;
575}
576
577function redirectToMountedPath(req, res, urlPath, basePath) {
578 if (basePath === "/" || !isGetOrHead(req) || looksLikeAssetRequest(urlPath)) {

Callers 1

handleStaticFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected