MCPcopy Create free account
hub / github.com/error311/FileRise / normalizeBasePath

Function normalizeBasePath

public/js/basePath.js:5–10  ·  view source on GitHub ↗
(base)

Source from the content-addressed store, hash-verified

3// behind a reverse proxy that strips the prefix, without impacting root installs.
4
5function normalizeBasePath(base) {
6 const b = String(base || '').trim();
7 if (!b || b === '/') return '';
8 const withSlash = b.startsWith('/') ? b : '/' + b;
9 return withSlash.replace(/\/+$/, '');
10}
11
12// Best-effort auto-detect from the *current URL* (works for /fr/, /fr/index.html, etc.).
13export function getBasePath() {

Callers 1

getBasePathFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected