Skip to content

Commit

Permalink
fix: don't show validation error on upload modal if password or max v…
Browse files Browse the repository at this point in the history
…iews are empty
  • Loading branch information
stonith404 committed Jan 2, 2024
1 parent 3ce18dc commit fe09d0e
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions frontend/src/components/upload/modals/showCreateUploadModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,15 @@ const CreateUploadModalBody = ({
.matches(new RegExp("^[a-zA-Z0-9_-]*$"), {
message: t("upload.modal.link.error.invalid"),
}),
password: yup.string().min(3).max(30),
maxViews: yup.number().min(1),
password: yup
.string()
.transform((value) => value || undefined)
.min(3)
.max(30),
maxViews: yup
.number()
.transform((value) => value || undefined)
.min(1),
});

const form = useForm({
Expand Down Expand Up @@ -151,8 +158,8 @@ const CreateUploadModalBody = ({
recipients: values.recipients,
description: values.description,
security: {
password: values.password,
maxViews: values.maxViews,
password: values.password || undefined,
maxViews: values.maxViews || undefined,
},
},
files,
Expand Down

0 comments on commit fe09d0e

Please sign in to comment.