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

Function stripBasePathFromUrl

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

Source from the content-addressed store, hash-verified

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

Callers 1

handleStaticFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected