diff --git a/packages/twenty-front/src/modules/settings/accounts/components/SettingsAccountsBlocklistInput.tsx b/packages/twenty-front/src/modules/settings/accounts/components/SettingsAccountsBlocklistInput.tsx index 84d4fb9355..42accc4cc5 100644 --- a/packages/twenty-front/src/modules/settings/accounts/components/SettingsAccountsBlocklistInput.tsx +++ b/packages/twenty-front/src/modules/settings/accounts/components/SettingsAccountsBlocklistInput.tsx @@ -1,5 +1,6 @@ import { zodResolver } from '@hookform/resolvers/zod'; import { styled } from '@linaria/react'; +import { isNonEmptyString } from '@sniptt/guards'; import { useEffect } from 'react'; import { Controller, useForm } from 'react-hook-form'; import { Key } from 'ts-key-enum'; diff --git a/packages/twenty-server/src/utils/image.ts b/packages/twenty-server/src/utils/image.ts index dc7d41d7e4..f63b63be11 100644 --- a/packages/twenty-server/src/utils/image.ts +++ b/packages/twenty-server/src/utils/image.ts @@ -1,4 +1,5 @@ import { type AxiosInstance } from 'axios'; +import { isNonEmptyString } from '@sniptt/guards'; const cropRegex = /([w|h])([0-9]+)/; @@ -26,7 +27,7 @@ export const getImageBufferFromUrl = async ( url: string, axiosInstance: AxiosInstance, ): Promise => { - if (!url || typeof url !== 'string' || url.trim().length === 0) { + if (!isNonEmptyString(url) || url.trim().length === 0) { throw new Error('Invalid URL provided: URL must be a non-empty string'); } @@ -52,7 +53,7 @@ export const getImageBufferFromUrl = async ( const contentType = response.headers['content-type']; - if (contentType && !contentType.startsWith('image/')) { + if (isNonEmptyString(contentType) && !contentType.startsWith('image/')) { throw new Error( `Invalid content type: expected image/*, got ${contentType}`, ); diff --git a/yarn.lock b/yarn.lock index 89512a99f6..5d83cb9bb3 100644 --- a/yarn.lock +++ b/yarn.lock @@ -29018,25 +29018,15 @@ __metadata: languageName: node linkType: hard -"axios@npm:^1.12.0, axios@npm:^1.13.5, axios@npm:^1.6.1, axios@npm:^1.7.7, axios@npm:^1.8.3": - version: 1.13.5 - resolution: "axios@npm:1.13.5" +"axios@npm:^1.12.0, axios@npm:^1.13.5, axios@npm:^1.6.1, axios@npm:^1.7.7, axios@npm:^1.8.3, axios@npm:^1.9.0": + version: 1.16.1 + resolution: "axios@npm:1.16.1" dependencies: - follow-redirects: "npm:^1.15.11" + follow-redirects: "npm:^1.16.0" form-data: "npm:^4.0.5" - proxy-from-env: "npm:^1.1.0" - checksum: 10c0/abf468c34f2d145f3dc7dbc0f1be67e520630624307bda69a41bbe8d386bd672d87b4405c4ee77f9ff54b235ab02f96a9968fb00e75b13ce64706e352a3068fd - languageName: node - linkType: hard - -"axios@npm:^1.9.0": - version: 1.13.6 - resolution: "axios@npm:1.13.6" - dependencies: - follow-redirects: "npm:^1.15.11" - form-data: "npm:^4.0.5" - proxy-from-env: "npm:^1.1.0" - checksum: 10c0/51fb5af055c3b85662fa97df17d986ae2c37d13bf86d50b6bb36b6b3a2dec6966a1d3a14ab3774b71707b155ae3597ed9b7babdf1a1a863d1a31840cb8e7ec71 + https-proxy-agent: "npm:^5.0.1" + proxy-from-env: "npm:^2.1.0" + checksum: 10c0/2f77e37e6552bbff8a772d058fb09500198e9188c6b20dc799d82dbe12a8cb506f6eed4e4e62a9ba612a35cbab496faa26d68f9bff14a53af6d15c3e136391a7 languageName: node linkType: hard @@ -36873,13 +36863,13 @@ __metadata: languageName: node linkType: hard -"follow-redirects@npm:^1.15.11": - version: 1.15.11 - resolution: "follow-redirects@npm:1.15.11" +"follow-redirects@npm:^1.16.0": + version: 1.16.0 + resolution: "follow-redirects@npm:1.16.0" peerDependenciesMeta: debug: optional: true - checksum: 10c0/d301f430542520a54058d4aeeb453233c564aaccac835d29d15e050beb33f339ad67d9bddbce01739c5dc46a6716dbe3d9d0d5134b1ca203effa11a7ef092343 + checksum: 10c0/a1e2900163e6f1b4d1ed5c221b607f41decbab65534c63fe7e287e40a5d552a6496e7d9d7d976fa4ba77b4c51c11e5e9f683f10b43011ea11e442ff128d0e181 languageName: node linkType: hard @@ -50235,6 +50225,13 @@ __metadata: languageName: node linkType: hard +"proxy-from-env@npm:^2.1.0": + version: 2.1.0 + resolution: "proxy-from-env@npm:2.1.0" + checksum: 10c0/ed01729fd4d094eab619cd7e17ce3698b3413b31eb102c4904f9875e677cd207392795d5b4adee9cec359dfd31c44d5ad7595a3a3ad51c40250e141512281c58 + languageName: node + linkType: hard + "proxy-memoize@npm:3.0.1": version: 3.0.1 resolution: "proxy-memoize@npm:3.0.1"