Fix workspaceLogo in invite-email (#5865)

## Fixes wrong image url in email 

![image](https://github.com/twentyhq/twenty/assets/29927851/5fb1524b-874d-4723-8450-0284382bbeb3)

## Done
- duplicates and adapt `getImageAbsoluteURIOrBase64` from `twenty-front`
in `twenty-email`
- send `SERVER_URL` to email builder
This commit is contained in:
martmull
2024-06-14 12:36:24 +02:00
committed by GitHub
parent a2e89af6b2
commit 28202cc9e0
3 changed files with 22 additions and 1 deletions

View File

@ -0,0 +1,16 @@
export const getImageAbsoluteURIOrBase64 = (
imageUrl?: string | null,
serverUrl?: string,
) => {
if (!imageUrl) {
return null;
}
if (imageUrl?.startsWith('data:') || imageUrl?.startsWith('https:')) {
return imageUrl;
}
return serverUrl?.endsWith('/')
? `${serverUrl.substring(0, serverUrl.length - 1)}/files/${imageUrl}`
: `${serverUrl || ''}/files/${imageUrl}`;
};