MCPcopy Index your code
hub / github.com/coder/code-server / relativeRoot

Function relativeRoot

src/node/http.ts:163–166  ·  view source on GitHub ↗
(originalUrl: string)

Source from the content-addressed store, hash-verified

161 * standard `url` property making it impossible to get the true depth.
162 */
163export const relativeRoot = (originalUrl: string): string => {
164 const depth = (originalUrl.split("?", 1)[0].match(/\//g) || []).length
165 return normalize("./" + (depth > 1 ? "../".repeat(depth - 1) : ""))
166}
167
168/**
169 * A helper function to construct a redirect path based on

Callers 2

constructRedirectPathFunction · 0.85

Calls 1

normalizeFunction · 0.90

Tested by

no test coverage detected