From acc35f47178e230f50ce54d6f1ad5370caa3382d Mon Sep 17 00:00:00 2001 From: Elias Schneider Date: Fri, 3 Nov 2023 14:05:43 +0100 Subject: [PATCH] fix: wrong validation of setting max share expiration to `0` --- .../components/share/modals/showCreateReverseShareModal.tsx | 5 ++++- .../src/components/upload/modals/showCreateUploadModal.tsx | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/frontend/src/components/share/modals/showCreateReverseShareModal.tsx b/frontend/src/components/share/modals/showCreateReverseShareModal.tsx index 46be7c408..027848cfa 100644 --- a/frontend/src/components/share/modals/showCreateReverseShareModal.tsx +++ b/frontend/src/components/share/modals/showCreateReverseShareModal.tsx @@ -72,7 +72,10 @@ const Body = ({ "", ) as moment.unitOfTime.DurationConstructor, ); - if (expirationDate.isAfter(moment().add(maxExpirationInHours, "hours"))) { + if ( + maxExpirationInHours != 0 && + expirationDate.isAfter(moment().add(maxExpirationInHours, "hours")) + ) { form.setFieldError( "expiration_num", t("upload.modal.expires.error.too-long", { diff --git a/frontend/src/components/upload/modals/showCreateUploadModal.tsx b/frontend/src/components/upload/modals/showCreateUploadModal.tsx index e9a3aefff..72490c964 100644 --- a/frontend/src/components/upload/modals/showCreateUploadModal.tsx +++ b/frontend/src/components/upload/modals/showCreateUploadModal.tsx @@ -126,6 +126,7 @@ const CreateUploadModalBody = ({ ) as moment.unitOfTime.DurationConstructor, ); if ( + options.maxExpirationInHours != 0 && expirationDate.isAfter( moment().add(options.maxExpirationInHours, "hours"), )