fix: add logo url response status check when creating workspace (#9474)

### Context
Workspace logo for work email is generated via twenty favicon service.
If twenty favicon can not find user domain favicon, it responds with
404.
### Fix
Check logo url before saving it when creating new workspace

closes #9359

---------

Co-authored-by: etiennejouan <jouan.etienne@gmail.com>
This commit is contained in:
Etienne
2025-01-09 14:07:48 +01:00
committed by GitHub
parent 8c1b9bf540
commit b61db75fc5

View File

@ -393,9 +393,20 @@ export class SignInUpService {
}
}
const logo = isWorkEmail(email)
? `${TWENTY_ICONS_BASE_URL}/${getDomainNameByEmail(email)}`
: undefined;
const logoUrl = `${TWENTY_ICONS_BASE_URL}/${getDomainNameByEmail(email)}`;
const isLogoUrlValid = async () => {
try {
return (
(await this.httpService.axiosRef.get(logoUrl, { timeout: 600 }))
.status === 200
);
} catch {
return false;
}
};
const logo =
isWorkEmail(email) && (await isLogoUrlValid()) ? logoUrl : undefined;
const workspaceToCreate = this.workspaceRepository.create({
subdomain: await this.domainManagerService.generateSubdomain(),