17 lines
521 B
TypeScript
17 lines
521 B
TypeScript
/**
|
|
* Storage metadata keeps workspace files under
|
|
* `workspace/<owner-user-id>/<logical-path>`. That owner segment is an
|
|
* implementation detail and should never be presented as part of a script's
|
|
* user-facing path.
|
|
*/
|
|
export function displayScriptPath(relativePath: string): string {
|
|
const normalized = relativePath.replaceAll("\\", "/");
|
|
const parts = normalized.split("/");
|
|
|
|
if (parts[0] === "workspace" && parts[1] && parts.length > 2) {
|
|
return parts.slice(2).join("/");
|
|
}
|
|
|
|
return normalized;
|
|
}
|