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:
@ -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(),
|
||||
|
||||
Reference in New Issue
Block a user