Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
sagemathinc
GitHub Repository: sagemathinc/cocalc
Path: blob/master/src/packages/hub/proxy/util.ts
1496 views
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