CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In
sagemathinc

Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.

GitHub Repository: sagemathinc/cocalc
Path: blob/master/src/packages/hub/proxy/util.ts
Views: 687
1
import basePath from "@cocalc/backend/base-path";
2
3
/*
4
Strip the base path from a url.
5
The resulting url will start with a /.
6
*/
7
8
export function stripBasePath(url: string): string {
9
if (basePath.length <= 1) {
10
// base path is just "/" so do NOT remove anything.
11
return url;
12
}
13
// base path is something like "/foo/bar", so remove it.
14
// In particular, it does not end in a /.
15
return url.slice(basePath.length);
16
}
17
18