Skip to content

The open alternative to Salesforce, designed for AI.

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

Etienneb61db75fc52a
diff --git a/packages/twenty-server/src/engine/core-modules/auth/services/sign-in-up.service.ts b/packages/twenty-server/src/engine/core-modules/auth/services/sign-in-up.service.ts
index 900a3dec2f1..02d7d22bd56 100644
--- a/packages/twenty-server/src/engine/core-modules/auth/services/sign-in-up.service.ts
+++ b/packages/twenty-server/src/engine/core-modules/auth/services/sign-in-up.service.ts
@@ -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(),