Fix axios related dependabot alerts generated against root yarn.lock (#21187)
Fixes the following Dependabot alerts: https://github.com/twentyhq/twenty/security/dependabot?q=is%3Aopen+package%3Aaxios+manifest%3Ayarn.lock+has%3Apatch Upgraded the referenced version in root yarn.lock. Creating a separate PR for the nested ones to keep the updates isolated (e.g. /seed-dependencies/yarn.lock).
This commit is contained in:
@@ -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<Buffer> => {
|
||||
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}`,
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user