You've already forked immich
mirror of
https://github.com/immich-app/immich.git
synced 2025-08-09 23:17:29 +02:00
fix(server): avoid server error for invalid email data type (#10978)
* fix(server): avoid server error for invalid email data type * add e2e test * fix e2e
This commit is contained in:
@@ -152,11 +152,14 @@ export function validateCronExpression(expression: string) {
|
||||
return true;
|
||||
}
|
||||
|
||||
type IValue = { value: string };
|
||||
type IValue = { value: unknown };
|
||||
|
||||
export const toEmail = ({ value }: IValue) => (value ? value.toLowerCase() : value);
|
||||
export const toEmail = ({ value }: IValue) => (typeof value === 'string' ? value.toLowerCase() : value);
|
||||
|
||||
export const toSanitized = ({ value }: IValue) => sanitize((value || '').replaceAll('.', ''));
|
||||
export const toSanitized = ({ value }: IValue) => {
|
||||
const input = typeof value === 'string' ? value : '';
|
||||
return sanitize(input.replaceAll('.', ''));
|
||||
};
|
||||
|
||||
export const isValidInteger = (value: number, options: { min?: number; max?: number }): value is number => {
|
||||
const { min = Number.MIN_SAFE_INTEGER, max = Number.MAX_SAFE_INTEGER } = options;
|
||||
|
Reference in New Issue
Block a user