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

Function stripBasePathFromUrl

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

Source from the content-addressed store, hash-verified

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

Callers 1

handleStaticFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected