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 46be7c40..027848cf 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 e9a3aeff..72490c96 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"), )