1
0
mirror of https://github.com/stonith404/pingvin-share.git synced 2024-11-16 12:20:13 +01:00

fix: don't show validation error on upload modal if password or max views are empty

This commit is contained in:
Elias Schneider 2024-01-02 21:33:15 +01:00
parent 3ce18dc1dc
commit fe09d0e25f
No known key found for this signature in database
GPG Key ID: 07E623B294202B6C

View File

@ -92,8 +92,15 @@ const CreateUploadModalBody = ({
.matches(new RegExp("^[a-zA-Z0-9_-]*$"), { .matches(new RegExp("^[a-zA-Z0-9_-]*$"), {
message: t("upload.modal.link.error.invalid"), message: t("upload.modal.link.error.invalid"),
}), }),
password: yup.string().min(3).max(30), password: yup
maxViews: yup.number().min(1), .string()
.transform((value) => value || undefined)
.min(3)
.max(30),
maxViews: yup
.number()
.transform((value) => value || undefined)
.min(1),
}); });
const form = useForm({ const form = useForm({
@ -151,8 +158,8 @@ const CreateUploadModalBody = ({
recipients: values.recipients, recipients: values.recipients,
description: values.description, description: values.description,
security: { security: {
password: values.password, password: values.password || undefined,
maxViews: values.maxViews, maxViews: values.maxViews || undefined,
}, },
}, },
files, files,