scrivito
Version:
Scrivito is a professional, yet easy to use SaaS Enterprise Content Management Service, built for digital agencies and medium to large businesses. It is completely maintenance-free, cost-effective, and has unprecedented performance and security.
15 lines (11 loc) • 381 B
text/typescript
/**
* Return an app URL, if the original uiUrl references a packaged UI URL.
* Otherwise return null.
* */
export function appUrlFromPackagedUiUrl(uiUrl: string): string | null {
const url = new URL(uiUrl);
const pathname = url.pathname.replace(/^(\/scrivito(?=\/|$))+/i, '');
if (pathname === url.pathname) return null;
url.pathname = pathname;
return url.href;
}