cal/packages/app-store/getAppAssetFullPath.ts
Hariom Balhara 51695ee79d
chore/AppStore: Remove deprecated imageSrc and make the paths relative in logo (#8479)
* Remove depreated imageSrc and make the paths relative in logo

* Do logo replacement at a single place

* Make logo relative at other places

* Fix campfire page not working in dev environment
2023-04-26 12:03:34 +01:00

11 lines
437 B
TypeScript

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;
}