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

fix: wrong validation of setting max share expiration to 0

This commit is contained in:
Elias Schneider 2023-11-03 14:05:43 +01:00
parent 33742a043d
commit acc35f4717
No known key found for this signature in database
GPG Key ID: 07E623B294202B6C
2 changed files with 5 additions and 1 deletions

View File

@ -72,7 +72,10 @@ const Body = ({
"", "",
) as moment.unitOfTime.DurationConstructor, ) as moment.unitOfTime.DurationConstructor,
); );
if (expirationDate.isAfter(moment().add(maxExpirationInHours, "hours"))) { if (
maxExpirationInHours != 0 &&
expirationDate.isAfter(moment().add(maxExpirationInHours, "hours"))
) {
form.setFieldError( form.setFieldError(
"expiration_num", "expiration_num",
t("upload.modal.expires.error.too-long", { t("upload.modal.expires.error.too-long", {

View File

@ -126,6 +126,7 @@ const CreateUploadModalBody = ({
) as moment.unitOfTime.DurationConstructor, ) as moment.unitOfTime.DurationConstructor,
); );
if ( if (
options.maxExpirationInHours != 0 &&
expirationDate.isAfter( expirationDate.isAfter(
moment().add(options.maxExpirationInHours, "hours"), moment().add(options.maxExpirationInHours, "hours"),
) )