1import basePath from "@cocalc/backend/base-path"; 2 3/* 4Strip the base path from a url. 5The resulting url will start with a /. 6*/ 7 8export 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