cal.pub0.org/packages/app-store/getAppAssetFullPath.ts

11 lines
437 B
TypeScript
Raw Normal View History

import type { App } from "@calcom/types/App";
export function getAppAssetFullPath(assetPath: string, metadata: Pick<App, "dirName" | "isTemplate">) {
const appDirName = `${metadata.isTemplate ? "templates/" : ""}${metadata.dirName}`;
let assetFullPath = assetPath;
if (!assetPath.startsWith("/app-store/") && !/^https?/.test(assetPath)) {
assetFullPath = `/app-store/${appDirName}/${assetPath}`;
}
return assetFullPath;
}