recei and clear the code

This commit is contained in:
Peter Maquiran
2024-08-21 20:14:48 +01:00
parent 82c67b8976
commit 24aac56824
36 changed files with 319 additions and 246 deletions
+1 -4
View File
@@ -35,10 +35,7 @@ export const zodDataUrlSchema = z.string().refine(value => value.startsWith('dat
* ```
*/
export const base64Schema = z.string().refine(value => {
// Regular expression for Base64 validation
const isBase64 = /^[A-Za-z0-9+/=]*$/.test(value) && (value.length % 4 === 0);
// Check if the first 20 characters do not contain a comma
return isBase64 && !value.substring(0, 20).includes(',');
return !value.slice(0, 20).includes(',');
}, {
message: 'Invalid Base64 string or comma found in the first 20 characters'
});