Release 202505261445

This commit is contained in:
pluja
2025-05-26 14:45:22 +00:00
parent f2021a3027
commit ba809840c6
19 changed files with 910 additions and 486 deletions

View File

@@ -50,7 +50,7 @@ const USER_SECRET_TOKEN_DEV_USERS_REGEX = (() => {
}[]
const env =
// This file can also be called from faker.ts, where import.meta.env is not available
// This file can also be called from seed.ts, where import.meta.env is not available
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
(import.meta.env
? Object.fromEntries(specialUsersData.map(({ envToken }) => [envToken, import.meta.env[envToken]]))

View File

@@ -16,8 +16,8 @@ export const zodCohercedNumber = (zodPipe?: ZodTypeAny) =>
export const zodUrlOptionalProtocol = z.preprocess(
(input) => {
if (typeof input !== 'string') return input
const trimmedVal = input.trim()
return !/^\w+:\/\//i.test(trimmedVal) ? `https://${trimmedVal}` : trimmedVal
const cleanInput = input.trim().replace(/\/$/, '')
return !/^\w+:\/\//i.test(cleanInput) ? `https://${cleanInput}` : cleanInput
},
z.string().refine((value) => /^(https?):\/\/(?=.*\.[a-z]{2,})[^\s$.?#].[^\s]*$/i.test(value), {
message: 'Invalid URL',